Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77242 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53950 invoked from network); 16 Sep 2014 10:19:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2014 10:19:30 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:55712] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/BC-64534-FAE08145 for ; Tue, 16 Sep 2014 06:19:29 -0400 Received: by mail-qa0-f51.google.com with SMTP id i13so5210711qae.24 for ; Tue, 16 Sep 2014 03:19:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=gpyIl1ivjUP5xMVtcYl/IswNvRjayXptaGj2GuYvL6E=; b=SSyMwfItkDhFQKWSAzoJqlLvZWI0VgxKcvY1wPiylz4WNj9TQstjuicoHtFnFEHHkA 8i6YixaoMJI7Qo7sTKd47SvJ5Oy7TjDF2T7eLnVRgbCcWbSAsMiRb+J1W9xhzcaLIqQI XgwMKin6MagTXtGHthYWeeqASaAw01oR7B/cu60wVg2fe4VTmJ5ypXUtZYEK14HbZrQJ CoaIGp7sOpPsHeG03vmCGGL8Vom1PaBRhBSeweiqjZY+wvZNNyAEzqdfhiDXDKQXqlJ8 RTWM836yends1f1+DfJ1OtigIuK6GVf5XjiFIzTJOC4f59WgFb/6Fl5SKyz/oFuzuQYI v0qQ== MIME-Version: 1.0 X-Received: by 10.224.21.68 with SMTP id i4mr45853844qab.83.1410862765339; Tue, 16 Sep 2014 03:19:25 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.141.28.193 with HTTP; Tue, 16 Sep 2014 03:19:25 -0700 (PDT) In-Reply-To: References: <528B8D9E-58FF-47DD-9B91-013F8844EC70@ajf.me> <93C6A290-493F-42B3-824B-AE81ACCDBA61@ajf.me> Date: Tue, 16 Sep 2014 11:19:25 +0100 X-Google-Sender-Auth: bFM0ymCpo5iVsCw5Q2PcgybwsZI Message-ID: To: Dmitry Stogov Cc: Andrea Faulds , Levi Morrison , PHP Developers Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE][RFC] Integer Semantics From: cw@daverandom.com (Chris Wright) On 16 September 2014 11:05, Dmitry Stogov wrote: > you already made silent break for N << 64 and N >> 64, but it may be > explained as more consistent behaviour. > I don't see a big difference with negative shifts. > > The real thing that I don't like - is a "boolean" result. Warning is not = a > big problem. I'm inclined to agree with this. The warning makes sense as it's almost certainly a userland bug, and if the expected old behaviour is desired it can easily be modified in userland, but returning FALSE doesn't make a huge amount of sense. This will almost certainly be immediately cast to int(0) by the next operation - almost no-one is going to actually check for a return value of FALSE - so it makes more sense to just return 0 and avoid the implicit cast. This would also produce possibly-unexpected results if a future operation was to stringify the result, as FALSE would cast to the empty string. I have voted in favour of the RFC as it stands as I believe that overall the changes are positive, but ideally this particular case would be addressed. > > Thanks. Dmitry. > > > > On Tue, Sep 16, 2014 at 1:23 PM, Andrea Faulds wrote: > >> >> On 16 Sep 2014, at 10:16, Dmitry Stogov wrote: >> >> > Shifts by negative number may make sense. (N << -1) =3D> (N >> 1) >> > At least receiving "false" from shift is not very pleasant. >> >> The problem is that changing from the current behaviour (undefined in C, >> but typically a shift by (PHP_INT_MAX - $bits)) to do what you=E2=80=99d= expect >> (shift in the opposite direction) would be a silent BC break. I think it= =E2=80=99s >> better to just stop it altogether and raise an E_WARNING, where it=E2=80= =99s at >> least obvious something went wrong, than change this behaviour silently. >> >> > In the patch you use SIZEOF_LONG. It probably should be changed to >> > SIZEOF_ZEND_LONG. >> >> Will fix, thanks for spotting that. >> >> -- >> Andrea Faulds >> http://ajf.me/ >> >> >> >> >>