If the order of evaluation of sub expressions is not guaranteed, then why is this correct?
int a = 1;
a = a + 1;
Here the compiler could evaluate first a
and then a + 1
so a can be 1 or 2
while this is not:
a = a++;
Here the compiler could evaluate first a
and then a++
son a can be 1 or 2.
What's the difference?