Skip to main content

3 docs tagged with "undefined-behavior"

View all tags

Default Initialization

Object created without explicit initializer. Behavior depends on type and storage duration. Dangerous for fundamental types in local scope.

Strict Aliasing Rule

Pointers of different types cannot point to the same memory (with exceptions). Enables compiler optimizations but causes undefined behavior when violated.

Undefined Behavior

Undefined Behavior (UB) occurs when the C++ standard places no requirements on what happens in a given situation. The program may crash, produce incorrect results, or appear to work correctly—there are no guarantees.