Undefined Behaviour
From Cppwiki
(Redirected from undefined behaviour)
undefined behavior
behavior, such as might arise upon use of an erroneous program construct or erroneous data, for which this International Standard imposes no requirements. Undefined behavior may also be expected when this International Standard omits the description of any explicit definition of behavior.
- — ISO/IEC 14882:1998, ยง1.3.12
Undefined behaviour occurs when a program does something the result of which is not specified by the standard. Undefined behaviour includes, for example, dereferencing a null pointer, or deleting an object twice. While many occurances of undefined behaviour are programming errors (bugs), some programs make use of undefined behaviour deliberately, because they are only intended to run on implementations which provide well-defined semantics for the behaviour. Even when something is left undefined by the standard, the implementation is free to provide such well-defined semantics. (Compare implementation-defined behaviour, which is not specified by the standard, but which implementations are required to document).