variable++ doesn't behave the same in Arduino 1.8.9??

I recently updated my Arduino setup from an older version (1.5 ish) to 1.8.9. After many hours debugging to see why my sketch worked in 1.5 and not in 1.8.9 I found that this code in an ISR(ADC_vect) interrupt:

counterBuff = counterBuff++;

no longer incremented counterBuff from a value of 0. I had to change it to the following to get it to increment.

counterBuff = counterBuff + 1;

Not sure if this is sloppy coding on my part or if some spec changed that I didn't know about. I'm paranoid what else may have changed.

sonicnuance:
I recently updated my Arduino setup from an older version (1.5 ish) to 1.8.9. After many hours debugging to see why my sketch worked in 1.5 and not in 1.8.9 I found that this code in an ISR(ADC_vect) interrupt:

counterBuff = counterBuff++;

no longer incremented counterBuff from a value of 0. I had to change it to the following to get it to increment.

counterBuff = counterBuff + 1;

Not sure if this is sloppy coding on my part or if some spec changed that I didn't know about. I'm paranoid what else may have changed.

It was never supposed to "work".
What happening with: "i = i++" is that i is being assign a value twice. The first time i is assigned i+1. The second time i is assigned i.

If you think about it a bit, you will realize you're trying to do something kinda silly.

The whole point of the ++ operator is to increment a variable. It doesn't matter whether you do a pre-increment or post-increment, x++ WILL increment x, with NO need to re-assign x. These three examples will ALL assign 6 to x:

int x = 5;
x = x + 1;
int x = 5;
++x;
int x = 5;
x++;

ANY of the above will do what you expect. Now, what you're doing, even logically, should NOT necessarily be expected to increment x:

int x = 5;
x = x++;

Looking at this logically, it is saying, USE the value of x, THEN increment x. This could be expected to set the value of x to it's current value (5), THEN increment x (to 6). But, due to the way c evaluates expressions, the outcome is, in fact UNDEFINED, per the c language specification. Will it first write 5 to x, THEN re-write it to 6, or the other way around? When this code is run, it could end up with x set to 5, OR 6, and EITHER result would be considered "correct".

http://www.cplusplus.com/forum/beginner/135021/

Regards,
Ray L

Go into Preferences and change your Compiler warnings setting from Default to All.

C:\Users\XXX\AppData\Local\Temp\arduino_modified_sketch_612922\sketch_apr11a.ino: In function 'void setup()':

C:\Users\XXX\AppData\Local\Temp\arduino_modified_sketch_612922\sketch_apr11a.ino:4:30: warning: operation on 'counterBuff' may be undefined [-Wsequence-point]

   counterBuff = counterBuff++;
                              ^