http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48814

--- Comment #2 from Johannes Schaub <schaub.johannes at googlemail dot com> 
2011-04-29 10:42:12 UTC ---
Since the order of evaluation is undefined it may evaluate "count++" and
"incr()" in any order, as it pleases. 

Since there is a sequence point before entering a function, and before leaving
a function, and since function invocations do not interleave, we know that no
matter whether we evaluate "count++" before or after executing "incr", the side
effects of both "count++" and "++count" do not happen without an intervening
sequence point.

Sequence points have that effect of guaranteeing that side effects of previous
evaluations have been finished, and side effects of subsequent evaluations have
not yet occured.

Undefined behavior would occur if the two side effects would occur without an
intervening sequence point. For example, if we were to replace "incr()" by a
plain "++count".

Reply via email to