Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85733 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42993 invoked from network); 4 Apr 2015 18:40:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2015 18:40:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:36977] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/11-27430-72030255 for ; Sat, 04 Apr 2015 13:40:40 -0500 Received: from dslb-092-078-029-076.092.078.pools.vodafone-ip.de ([92.78.29.76] helo=[192.168.178.30]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1YeSzk-0004BC-Ie; Sat, 04 Apr 2015 20:40:36 +0200 Message-ID: <55203024.208@mabe.berlin> Date: Sat, 04 Apr 2015 20:40:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: <33BCE1D0-BA6D-464C-B23D-69AF71356111@ajf.me> <3932E76B-DC75-40CD-8B1A-B84F387707CC@ajf.me> <99074900-317F-44A8-970D-545EF7F4C4D8@ajf.me> In-Reply-To: <99074900-317F-44A8-970D-545EF7F4C4D8@ajf.me> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1428172840;db800588; Subject: Re: [PHP-DEV] Re: Fix division by zero to throw exception From: dev@mabe.berlin (Marc Bennewitz) Am 04.04.2015 um 00:13 schrieb Andrea Faulds: >> On 3 Apr 2015, at 23:08, Dmitry Stogov wrote: >> >> On Apr 4, 2015 12:34 AM, "Nikita Popov" wrote: >>> Don't think we need to disable compile-time evaluation for 2) and 3). It'll just end up being a compile error in that case. I think if you have 1 % 0 occurring in your code literally, it's better to have the compile fail rather than getting (or not getting) a runtime exception. >> This is even easier. >> Andrea, what do you think? > I was wondering if that might cause problems if you have a large codebase and some unfixed errors in a few places. If the code isn’t being run, only compiled, then it’d be unnecessary pain. However, the chances of a codebase having numerous undetected divisions by zero, that are obvious at compile-time, aren’t very high. So, failing at compile-time is fine. > > And, to save another email, I agree with the four items in your summary. Exceptions for negative shift, modulo/intdiv by zero, normal division by zero is +/-INF. :) If the normal division by zero produces +/- INF it's a valid calculation and shouldn't trigger a warning else it should end up in an exception, too. > -- > Andrea Faulds > http://ajf.me/ > > > > >