4 ms·
Undefined behavior allows a compiler to make assumptions that some things never happen, which can allow them to generate more efficient code by not having to ge
by Retra 8y ago
Undefined behavior allows a compiler to make assumptions that some things never happen, which can allow them to generate more efficient code by not having to generate code that checks if those assumptions are correct.
If you're going around thinking computing resources are cheap, it doesn't make much sense to avoid those correctness checks, and undefined behavior is probably not good from that perspective.