Mail Archives: djgpp/1998/06/05/18:15:30
> printf("%d %d %d", i, i++, i++);
> Using DJGPP I got the output "3 2 1" which is wrong.
> I also compiled this with Visual C++ 5 and the output was "1 1 1".
> Can anyone help me solve this?
The solution is, "Don't do that." The order of parameter
evaluation is compiler-dependent, and the order of applying
multiple post-increments is compiler-dependent. Depending on
the compiler, you could also get "1 1 2", "1 2 3", or "3 3 3".
Be less clever, it's easier for the compiler and the reader.
- Raw text -