Am 04.04.2015 um 00:13 schrieb Andrea Faulds:
On 3 Apr 2015, at 23:08, Dmitry Stogov <dmi...@zend.com> wrote:
On Apr 4, 2015 12:34 AM, "Nikita Popov" <nikita....@gmail.com> 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/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php