3 ms·
> You can't turn hitting that undefined behaviour into a compiler error, as distinguishing between the two requires solving the halting problem. That's a fair
by AnIdiotOnTheNet 5y ago
> You can't turn hitting that undefined behaviour into a compiler error, as distinguishing between the two requires solving the halting problem.
That's a fair point, but it still feels wrong to me that the compiler can throw away large chunks of code and change the outcome of the function silently.
- Blaisorblade0 5y agoThrowing away large chunks of code is what optimizers exist for! Sadly, most discussions of UB only show when it "goes wrong" (has surprising results), not when it goes right!