Mail Archives: djgpp/1998/06/09/08:46:36
Dennis Voss wrote:
> printf("%d %d %d", i, i++, i++);
...
> Using DJGPP I got the output "3 2 1" which is wrong.
Ask yourself this question: Why is that wrong?
It is not wrong.
> I also compiled this with Visual C++ 5 and the output was "1 1 1".
Hint: This is not wrong either.
> Can anyone help me solve this?
The answer is that an expression with side effects involving the same
lvalue multiple times are in general undefined. Solution: Don't do
that.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm:+37.20.07/-121.53.38
\
She glanced at her watch / . . . It was 9:23.
/ James Clavell
- Raw text -