How to increment a variable [modified]
-
"Oh, I see by your variable name that you intended this to be an unsigned imaginary number. Level of certainty: 95%" That's not actually what the output said, but that's an example of the kind of thing that I imagined the compiler saying that as it was processing the code. I do seem to recall it giving some kind of "level of certainty".
We are dyslexic of Borg. Refutance is systile. Your a$$ will be laminated!
That's right. It was somewhat conversational with a hint of arrogant superiority. You wrote "this" (you bonehead). PL/C chooses to do "this". If smileys had been invented then I'm sure it would have followed with a :P
-
It was in release mode of course otherwise it's only normal that it wouldn't do any optimizations :) Ok didn't think of volatile - well then "any variable or field that is not volatile" can have an assignment to itself removed without any harm (unless you're doing scary reflection tricks..) But the JIT compiler is a problem.. how can you see what code it produces?
I don't like to think what would happen to "i = i++" if "i" is truely volatile. Would the post increment be actioned on an interrupt modified value? Now that would be a good bug to find!