4 ms·
In the answer to 9 I don't see why 'Evaluating ++i + ++i would produce undefined behavior'
by vainguard 15y ago
In the answer to 9 I don't see why 'Evaluating ++i + ++i would produce undefined behavior'
- prodigal_erik 15y agoThere's no http://en.wikipedia.org/wiki/Sequence_point http://en.wikipedia.org/wiki/Sequence_point between the two increments, so the standard allows the compiler to do pretty much anything, even http://catb.org/jargon/html/N/nasal-demons.html http://catb.org/jargon/html/N/nasal-demons.html. The way I've heard it, these operators were added to take advantage of pre- and post-increment hardware support in the PDP-11 (forty years ago!), and everyone just knew what would happen, but ANSI later wanted compilers to have enough latitude to take advantage of other hardware which behaves differently.
- vainguard 15y agoJust when I thought (after completing the puzzles) that C is reasonably reasonable language, I learn that the execution order of 'f()+g()' is unspecified. Wow!