3 ms·
Indeed. Though one of the confusing issue with UBs is that the purpose of the UB varies. Some UBs are really close cousins of IBs like UBs on signed overflow:
by masklinn 5y ago
Indeed.
Though one of the confusing issue with UBs is that the purpose of the UB varies.
Some UBs are really close cousins of IBs like UBs on signed overflow: it could be IB but was probably found not worth the status, so was left undefined.
Others are about the intersection of efficiency and lack of expressivity, like dereferencing null pointers: implicitly checking each and every access was (likely) considered too costly, but the language has no way of expressing nullability statically.
So given a language with C-type semantics, you don't need the first UB (though it can certainly be leveraged by compilers), while the second one is much harder to get rid off.