I came across the following statement:
A smart compiler can recognize that
x = x + 1can be treated the same as++x.
Why is the prefix-operator used here instead of the post-fix operator (or either, if it doesn't matter)? For example, if I had the following loop:
while (x < 10) {
...
x++; // wouldn't this be the same as doing ++x here?
}
What would be a case that shows how x = x + 1 is equivalent to ++x and not x++ ?