In Sroustrup, x++ is stated to be evaluated as:
t = x;
x += 1;
t;
where t signifies a temporary.
If we're talking about C (which I thought we were), Stroustrup is not
authoritative. The description you give is a reasonable working
approximation, but is inexact; the way it places the increment at a
specific time is one of the ways it is inexact.
In other words, the ++ increment is performed at its
occurrence
within the statement, not after the remainder of the statement has
been evaluated.
Yes, if that were how ++ were defined, that would be how it would be
done. But it's not.
A similar conundrum is:
int f( int, int, int);
n=1;
f(++n, ++n, ++n);
What gets passed to f? Why?
Anything or nothing - it is possible that f is not even called. Why?
Because there is no sequence point between the evaluation of different
arguments, so n is being incremented more than once without an
intervening sequence point. This places it in "undefined behaviour"
territory; the result may be anything whatsoever that the compiler is
capable of arranging for.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B