Bob Langelaan <
bobl...@gmail.com> wrote in news:e97438d7-404f-4a80-bc21-
cc697a...@googlegroups.com:
> If I have the following code:
>
> int var2 = 12;
> int var3 = 20;
>
> cout << '\n' << var2++ << " " << ++var2;
> cout << '\n' << var2;
>
> cout << "\n\n" << --var3 << " " << var3--;
> cout << '\n' << var3;
The behavior is undefined, anything can happen.
If instead of an int a class with user-defined ++ and -- operators was
used, then the behavior would be just unspecified and there would be a
couple of possible outputs, depending on which arguments happen to be
evaluated first.
IOW: don't write such code.