Re: Operator precedence is undefined?
| From: | Adam Harvey | Date: | Sat, 20 Jul 2013 05:46:22 +0000 |
| Subject: | Re: Operator precedence is undefined? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68256@lists.php.net to get a copy of this message | ||
(Piggy-backing on Sara's e-mail, although this is more a response to
Sherif and Yasuo.)
On 19 July 2013 22:33, Sara Golemon <pollita@php.net> wrote:
> I never said that the compiler might magically produce differing results
> for the same input. I said that the language's definition does not declare
> a defined behavior for such expressions with combined side effects.
This is also a classic piece of undefined behaviour in most C-like
languages — Bjarne Stroustrup lists it in his C++ FAQ, for instance:
http://www.stroustrup.com/bs_faq2.html#evaluation-order.
That's not to
say that PHP necessarily has to be the same as other languages in its
"family" (nested ternaries, anyone?), but I don't think that PHP is
really doing anything different here that would make it well defined:
AFAIK, the only places PHP makes guarantees about the order of
evaluation with regard to binary operators is short circuiting the
boolean operators.
> As to reverting commits. When the initial commit was made in haste during
> an active discussion, a revert is entirely appropriate and has nothing to
> do with placing one's opinion over another's. It has to do with placing
> the process of consensus building over unilateral cowboy commits.
+1.
Adam