Re: Evaluation of statements
| From: | Edward Marczak | Date: | Thu, 08 Jun 2000 20:48:39 +0000 |
| Subject: | Re: Evaluation of statements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1332@lists.php.net to get a copy of this message | ||
on 7/6/00 1:53 PM, Matthew Kendall shot down the bitstream:
> "Except where noted, the order of evaluation of operands of individual
> operators and subexpressions of individual expressions, and the order in
> which side effects take place, is unspecified."
>
> Your particular compiler may happen to evaluate in the order you wrote, but
> it does not have to. And its behaviour may change when you turn on the
> optimiser, for example.
Absolutely correct. Especially when it comes to 'and' logic. If any one
statement is false, the condition is false. So it's cheaper to evaluate the
'easiest' statement first - if it's false, why continue?
--
Ed Marczak
marczak@usa.net