It was thus said that the Great Chuck Guzis once stated:
On 3 Jun 2007 at 15:02, davis wrote:
A similar conundrum is:
int f( int, int, int);
n=1;
f(++n, ++n, ++n);
What gets passed to f? Why?
Well, "++n" is more defined than "n++" is, and basically,
pre-increment
MUST happen before the value is used, so in this fragment, n will have three
distinct values. As to what gets passed to f()? That's easy:
n = 1;
f(++n, ++n, ++n);
is the same as
f(4,3,2);
That's because function parameters are evaluated right to left. The
reason for that is due to the way early (and current) compilers were
constructed and the need to support variable argument functions like
printf() (it's a lot easier to find the first argument if you push them
right to left, than left to right).
-spc (Who avoids such bletcherous code)