Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53242 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37664 invoked from network); 10 Jun 2011 14:47:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2011 14:47:19 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:58313] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/3A-54720-67E22FD4 for ; Fri, 10 Jun 2011 10:47:19 -0400 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id EF834DE143; Fri, 10 Jun 2011 15:47:15 +0100 (BST) Date: Fri, 10 Jun 2011 15:47:15 +0100 (BST) X-X-Sender: derick@whisky To: Hannes Landeholm cc: PHP Developers Mailing List In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] 32 bit / 64 bit integer confusion From: derick@php.net (Derick Rethans) On Fri, 10 Jun 2011, Hannes Landeholm wrote: > What are the reasoning behind this? I think the PHP integer size > should be changed to always be 64 bit - independent of the platform. I > have stumbled on this annoying inconsistency several times the last > month. I agree that that should be the same. But sadly, Windows uses a different integer size model than almost everything else modern. Where Linux and Mac and other unices use 8 bytes for an "int", Windows uses 4 bytes (http://en.wikipedia.org/wiki/LP64#Specific_C-language_data_models). Because PHP internally uses "int" for its integer type, on Windows that's still only 32 bit. But yes, it would be awesome if PHP actually took care of this and uses 64 bit ints on 64 bit processors. > Also, telling developers that "an integer always > supports 64 bit" will make life much easier for them when they need it for > implementing large numbers in cryptography, date arithmetics, scientific > values, API interaction, etc etc. PHP's DateTime classes do use 64 bit integers internally, no matter on which processor (even 32bit ones). cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug