Lightning Talk: Your Favorite Undefined Behavior in C++
summary
Rapid-fire audience-sourced catalog of concrete C++ undefined behaviors with examples and surprising edge cases: macro expanding to the token "defined", infinite loops as UB, signed integer overflow and unsigned-promotion surprises for unsigned short multiplication, unions and bitcast UB, memcpy of zero is UB, taking addresses of standard-library functions, templates with no valid instantiation, casting away const, uninitialized stack variables, specializing standard templates (numeric_limits), object lifetime violations, and relaxed-atomics “out of thin air” values.
AI-written summary · about
chapters (23)
- 0:00Undefined behavior in C++
- 0:23Audience favorites
- 1:07Macros and unsigned integers
- 2:11Unions and type punning
- 3:18Overflow and library contracts
- 4:23Templates and const casting
- 5:50Uninitialized variables
- 6:52Integer shifting
- 7:34Stack overflow
- 8:17Compiler diagnostics
- 9:19Stack Overflow questions
- 9:40Function declarations
- 10:43Undefined behavior in the preprocessor
- 11:06Register keyword
- 11:49Arrays to function pointers
- 12:11Numeric limits specialization
- 13:19Trivial types
- 14:01Atomics and memcopy
- 14:44Object lifetime bypass
- 15:52Library specialization rules
- 16:33Relaxed atomics
- 17:46Out-of-thin-air values
- 18:06Closing remarks
related talks
03mLightning Talk: Undefined Behaviour in C++
15mC++ WAT
49mUndefined Behavior in 2017 (part 1 of 2)
05mDetecting Programs That Rely on Undefined Behavior
01h 04mRemoving Needless Undefined Behavior for a Safer C++
29mC++ Cryptozoology - A Compendium of Cryptic Characters
03mLightning Talk: C++ Catastrophes: A Poem
17mC++ Cryptozoology - A Compendium of Cryptic Characters
