Hacker News new | past | comments | ask | show | jobs | submit login

Undefined behavior entails "there are no restrictions on the behavior of the program", meaning anything can happen, including executing the opposite of the program text. Implementation defined behavior is saner in the sense that program behavior is still defined. Examples of the latter are the exact type of std::size_t or the number of bits in a byte: https://en.cppreference.com/w/cpp/language/ub



The linked reference page does not say that implementation-defined behaviour must be sensible, only that it must be defined. Contrast with unspecified behaviour where "Each unspecified behavior results in one of a set of valid results."

I expect that most instances of implementation-defined behaviour come with additional rules which state that the implementation has to define something sensible.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: