minus-squaremrkite@programming.devtoC++@programming.dev•C++ Should Be C++linkfedilinkarrow-up0·9 months agoIt violates the principle of least surprise. You don’t expect the compiler to delete your bounds checking etc. The way c and c++ define and use UB is like finding an error at compile time and instead of reporting it, the compiler decides to exploit it. linkfedilink
minus-squaremrkite@programming.devtoC++@programming.dev•C++ Should Be C++linkfedilinkarrow-up0·9 months agoShould focus on getting rid of undefined behavior. linkfedilink
It violates the principle of least surprise. You don’t expect the compiler to delete your bounds checking etc.
The way c and c++ define and use UB is like finding an error at compile time and instead of reporting it, the compiler decides to exploit it.