Undefined Behavior
A semantic category in the ISO C standard that permits a compiler to handle certain code in arbitrary ways, including producing seemingly correct output, crashing, silently corrupting data, or deleting the relevant code. Common cases include signed integer overflow, array out-of-bounds access, and null pointer dereference.
Timeline (last 90 days)
C++ was rated D-tier because there are dozens of ways to do the same thing, undefined behavior and memory bugs pass straight through the compiler, and the AI agent gets no error feedback, thus losing any handle for fixing problems.
Violating the safety rules of unsafe code can lead to undefined behavior, whose consequences include hard-to-reproduce crashes, data corruption, and even security vulnerabilities.
Signed integer overflow, out-of-bounds array reads and writes, dereferencing null or dangling pointers, violating sequence point rules, and reading uninitialized variables are all explicitly listed by the C standard as undefined behavior.
Undefined behavior (UB) in the C standard allows an implementation to do anything when it encounters that behavior, including producing seemingly correct output, crashing, silently corrupting data, or deleting the relevant code entirely after optimization.
The compiler assumes that signed addition never overflows, thereby concluding that certain boundary conditions are unreachable and deleting the corresponding check branches, which is extremely common at -O2 and above.
Undefined behavior (UB) refers to operations for which the language specification explicitly does not guarantee any behavior, such as dereferencing a dangling pointer, data races, out-of-bounds access, etc.
Rust's design goal is to statically eliminate the vast majority of undefined behavior at compile time through ownership and borrowing rules.
In Rust, soundness means: if the compiler accepts a piece of code, but that code may trigger undefined behavior at runtime, then the compiler is unsound.
All Facts (9)
The C and C++ standards define signed integer overflow as Undefined Behavior.
60%UnverifiedC++ was rated D-tier because there are dozens of ways to do the same thing, undefined behavior and memory bugs pass straight through the compiler, and the AI agent gets no error feedback, thus losing any handle for fixing problems.
50%UnverifiedViolating the safety rules of unsafe code can lead to undefined behavior, whose consequences include hard-to-reproduce crashes, data corruption, and even security vulnerabilities.
50%UnverifiedUndefined behavior (UB) in the C standard allows an implementation to do anything when it encounters that behavior, including producing seemingly correct output, crashing, silently corrupting data, or deleting the relevant code entirely after optimization.
50%UnverifiedSigned integer overflow, out-of-bounds array reads and writes, dereferencing null or dangling pointers, violating sequence point rules, and reading uninitialized variables are all explicitly listed by the C standard as undefined behavior.
50%UnverifiedThe compiler assumes that signed addition never overflows, thereby concluding that certain boundary conditions are unreachable and deleting the corresponding check branches, which is extremely common at -O2 and above.
50%UnverifiedIn Rust, soundness means: if the compiler accepts a piece of code, but that code may trigger undefined behavior at runtime, then the compiler is unsound.
50%UnverifiedRust's design goal is to statically eliminate the vast majority of undefined behavior at compile time through ownership and borrowing rules.
50%UnverifiedUndefined behavior (UB) refers to operations for which the language specification explicitly does not guarantee any behavior, such as dereferencing a dangling pointer, data races, out-of-bounds access, etc.
50%