Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85731 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90351 invoked from network); 3 Apr 2015 22:13:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2015 22:13:07 -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.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:56453] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/F8-23347-1701F155 for ; Fri, 03 Apr 2015 17:13:07 -0500 Received: from localhost (localhost [127.0.0.1]) by imap11.ox.privateemail.com (Postfix) with ESMTP id 2FC028800CB; Fri, 3 Apr 2015 18:13:03 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from imap11.ox.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LBQ41qiE7i22; Fri, 3 Apr 2015 18:13:03 -0400 (EDT) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by imap11.ox.privateemail.com (Postfix) with ESMTPSA id 63E018800E5; Fri, 3 Apr 2015 18:13:02 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Fri, 3 Apr 2015 23:13:00 +0100 Cc: Nikita Popov , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <99074900-317F-44A8-970D-545EF7F4C4D8@ajf.me> References: <33BCE1D0-BA6D-464C-B23D-69AF71356111@ajf.me> <3932E76B-DC75-40CD-8B1A-B84F387707CC@ajf.me> To: Dmitry Stogov X-Mailer: Apple Mail (2.2070.6) Subject: Re: Fix division by zero to throw exception From: ajf@ajf.me (Andrea Faulds) > On 3 Apr 2015, at 23:08, Dmitry Stogov wrote: >=20 > 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. >=20 > 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=E2=80=99= t being run, only compiled, then it=E2=80=99d be unnecessary pain. = However, the chances of a codebase having numerous undetected divisions = by zero, that are obvious at compile-time, aren=E2=80=99t 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. :) -- Andrea Faulds http://ajf.me/