F
Frederick Gotham
There are two common ways of implementing the postincrement operator:
(1) Copy-construct a temporary.
Increment the original.
Return the tempory.
(2) Create an "proxy" object which, upon its destruction, will increment
the original object.
Return the original object.
It appears to me that method (2) might act strangely in the following
circumstance:
x = x++, x++, x;
There's a sequence point between the comma operands, but any temporaries
aren't destroyed until the semi-colon is reached.
(1) Copy-construct a temporary.
Increment the original.
Return the tempory.
(2) Create an "proxy" object which, upon its destruction, will increment
the original object.
Return the original object.
It appears to me that method (2) might act strangely in the following
circumstance:
x = x++, x++, x;
There's a sequence point between the comma operands, but any temporaries
aren't destroyed until the semi-colon is reached.