3 ms·
undefined behaviour and Undefined Behaviour are the same thing… How would the standard define behavior that depends on the implementation. All they say for UB i
by Google234 5y ago
undefined behaviour and Undefined Behaviour are the same thing… How would the standard define behavior that depends on the implementation. All they say for UB is that there are no requirements for what will happen. How would your perfect language deal with a branch depending on some uninitialized boolean value?
- ithkuil 5y agoIt doesn't! That's the whole point I'm trying to make (poorly). People are not hating that (existing, popular, but unnamed here to avoid distraction) language because in practice that problem doesn't bother people at the same level that it bothers with C/C++! Why? Because the compiler is not actively exploiting each bad step you make. I think this is one of the reasons why discussing undefined behaviour is so confusing. From a technical/purist point of view, it clearly means something and once the behaviour is undefined, it is undefined and yadda yadda. But in practice it makes a huge difference, to the point that people tried to coin a new name for it (e.g. "unsafe code"), while it is the same thing.