Aha! OK, now after my 2nd glass of wine, things are starting to make sense.
When I saw this statement:
(assuming i = 0 before that line)
my first instinct would have been that it means something like this:
Code:
a[i] = i; // i.e. a[0] = 0;
i = i + 1;
but (if it wasn't undefined), since ++ is higher than = it would probably end up being something like:
Code:
temp = i;
i = i + 1;
a[i] = temp; // i.e. a[1] = 0;
So the reason why statements like that are undefined are:
1. To make compilers & optimizers easier to write.
and
2. To prevent us from making some stupid mistakes.
Is that about right, or did I miss anything?