Undefined Behavior
Noun · Development
Definitions
A condition in C, C++, and some other languages where the language standard imposes no requirements on the program's behavior — the compiler is free to assume it never happens, enabling aggressive optimizations that can cause the program to do literally anything, from producing wrong results silently to erasing bounds checks. Common causes include signed integer overflow, null pointer dereference, buffer overflows, and use-after-free.
In plain English: When your code does something the language rules say is not allowed, and the computer is free to do absolutely anything in response — including silently appearing to work until it doesn't.
Example: "The compiler optimized away the entire null check because dereferencing a null pointer is undefined behavior — so it assumed the pointer was never null."