3 ms·
This is a good reminder that "undefined behavior" includes "doing what I want it to do". It's also a good example of how undefined behavior allows for optimiza
by mikeash 12y ago
This is a good reminder that "undefined behavior" includes "doing what I want it to do".
It's also a good example of how undefined behavior allows for optimizations. The compiler is able to evaluate your expression at compile time rather than emitting a division instruction, even though this changes how the program behaves.
C sure is fun.