Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76922 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54165 invoked from network); 28 Aug 2014 15:45:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Aug 2014 15:45:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:48542] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/A4-28393-48E4FF35 for ; Thu, 28 Aug 2014 11:45:09 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 8D7C12400D4; Thu, 28 Aug 2014 11:45:05 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kM-rA7W-GJPJ; Thu, 28 Aug 2014 11:45:05 -0400 (EDT) Received: from [192.168.0.2] (05439dda.skybroadband.com [5.67.157.218]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 046EB2400DF; Thu, 28 Aug 2014 11:45:01 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 28 Aug 2014 16:44:59 +0100 Cc: Laruence , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <88F3B0AF-786C-43BA-AD39-3D8B77D13B2F@ajf.me> <3DEE6234-C839-4B48-A5D3-F15558CC5DFC@ajf.me> To: Derick Rethans X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Integer Semantics From: ajf@ajf.me (Andrea Faulds) On 22 Aug 2014, at 12:36, Derick Rethans wrote: > Although I think it is good to make it work the same on every = platform,=20 > I do think that changing it to *match* what the most used compiler = (GCC)=20 > on our most used platform (Linux/AMD64) is what the new behaviour = should=20 > be like =97 not something that "looks best". I think that's what = Laruence=20 > was trying to say as well. >=20 > It causes the least amount of BC breaks for our users. That would also be a possibility. It=92s not my favourite behaviour, but = it=92d at least be consistent. However, I wonder how many applications rely on the current behaviour on = AMD64. It=92s not terribly intuitive. For example, a shift by a negative = number works like this on AMD64: $op1 << ((PHP_INT_MAX + $op2) % 64) So, for example, were I to make $op2 be -1: $op1 << ((PHP_INT_MAX + $op2) % 64) $op1 << ((PHP_INT_MAX - 1) % 64) $op1 << (9223372036854775806 % 64) $op1 << 62 Which is probably not what the user was expecting. Actually, I kinda lied, that=92s just what *sane* compilers would do on = AMD64. Negative bit shifts are undefined behaviour in the C standard, = which gives the compiler an unlimited license to do absolutely anything = it wants, including, for example, to not execute the shift altogether = and assume it is dead code. In practise this is unlikely, however that = is the standard. You make a good point that this is a BC break, though. This RFC in = itself doesn=92t make a super-compelling case, given it doesn=92t really = introduce any benefits (aside from the fact you can rely on $x >> $y, = where $y >=3D 64, equalling zero). It might be better if I retracted = this RFC and kept these changes to the bigint RFC. -- Andrea Faulds http://ajf.me/