That's indeed the behavior of postfix operators, as detailed here.
For instance, when you write:
b = b++;
The following happens:
- The current value of
b
is saved, b
is incremented,- The saved value of
b
is produced by the postfix++
operator, - The value produced by the operator is assigned to
b
.
Therefore, b
will indeed be assigned its original value, and the incremented value is lost.