What happens (behind the curtains) when this is executed?
int x = 7; x = x++;
That is, when a variable is post incremented and assigned to
So this means: x++ is not equal to x = x+1
x++
x = x+1
because:
int x = 7; x = x++; x is 7 int x = 7; x = x = x+1; x is 8
and now it seems a bit strange:
int x = 7; x = x+=1; x is 8
very compiler dependent!