Undefined behavior results when programs attempt to do things for which the standard defines no
semantics, and requires no diagnostic either. Examples include dereferencing invalid pointers and
dividing by zero. Executing such programs may cause them to produce incorrect results, crash, silently "work", or even format the hard drive.
It is commonly
joked that undefined behavior allows the
compiler to insert code that will start a game of
nethack.