4 ms·
Yes, for m = INT_MAX and wrapping signed int, it is undefined behavior. Because of that, the compiler is allowed to assume m ≠ INT_MAX, and that can mean it ca
by Someone 5y ago
Yes, for m = INT_MAX and wrapping signed int, it is undefined behavior.
Because of that, the compiler is allowed to assume m ≠ INT_MAX, and that can mean it can generate more efficient and/or smaller code.
Assuming m ≠ INT_MAX isn’t (considered to be [1]) a big loss because chances are the programmer who wrote that didn’t intend to write an infinite loop.
[1] of course, is an opinion, but it’s the opinion the standards writers have had for decades.