Undefined behavior

From Esolang

(Redirected from Undefined behaviour)
Jump to: navigation, search

Undefined behavior is the result of any action in a programming language that the language specification specifically avoids defining, without making any suggestions as to what might happen. An example in an esoteric programming language would be a program going off the right side or bottom of code space in 2L. A non-esoteric example would be the following example in C:

a = a++ * b++;

Code that exhibits undefined behavior may produce unexpected and inconsistent results, crash the program (or the interpreter), cause an error, etc. An implementation has no responsibility to try to do anything that even remotely makes sense when faced with undefined behavior.

Personal tools