3 ms·
> If the compiler aborted compilation when it detected undefined behavior, you’d be getting a lot of false positives for unreachable code Could you please prov
by AvImd 6y ago
> If the compiler aborted compilation when it detected undefined behavior, you’d be getting a lot of false positives for unreachable code
Could you please provide an example of this?
- toasted_flakes 6y agoOverflow of signed integers is undefined. int add(int a, int b) { return a + b; } Unless the compiler can prove that `add` is never called with a and b values resulting in an overflow, this code can lead to UB, and, under your rules, the compilation aborts.