develooper Front page | perl.perl5.porters | Postings from July 2010

Re: Order of evaluation of terms (was peephole optimiser couldprune more dead code)

Thread Previous | Thread Next
From:
Zefram
Date:
July 15, 2010 11:14
Subject:
Re: Order of evaluation of terms (was peephole optimiser couldprune more dead code)
Message ID:
20100715181416.GB4363@lake.fysh.org
David Golden wrote:
>Again, from perlop:
>
>       Operator precedence means some operators are evaluated before others.
>       For example, in "2 + 4 * 5", the multiplication has higher precedence
>       so "4 * 5" is evaluated first yielding "2 + 20 == 22" and not "6 * 5 ==
>       30".

In that expression, the * operation does have to be performed before the
+ operation.  This does not imply anything about the order in which 2,
4, and 5 are evaluated (which would matter if they were expressions with
side effects).

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About