Mail Archives: djgpp/1998/06/05/18:15:29
Blaine Hodge writes:
>> > printf("%d %d %d", i, i++, i++);
>
>Yup. This is the correct response you should get. Arguements are
>popped onto the stack right to left for function calls.
[...]
>Then its VC at fault (gee, imagine that), sounds like its evaluating it
>using the Pascal calling method, left to right, and not C/C++, right to
>left.
Not true. I'm not 100% sure of the rules for argument evaluation, but I
suspect that different compilers are allowed to do these in whatever
order they prefer. I do know for a fact that the ANSI standard explcitly
says that the results are undefined if you use a ++ operator in a
statement that also modifies the variable in some other way. Eg. if you
were to write something like "i += i++;", the compiler is entitled to do
whatever the hell it likes with that statement, including nothing. The
error lies in the code, not the compiler...
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Miracles are nothing if you've got the wrong intentions" - Mike Keneally
- Raw text -