Signed integers are two's complement
summary
Claim: signed integer storage is narrowed to one true representation: two's complement, while arithmetic semantics (overflow) remain unspecified for now. Evidence comes from a hardware survey, GCC optimization analysis and real-world bug examples; proposed change becomes a committee paper and spawns library work such as __builtin_add_overflow / UBSan usage. Measured compiler cost of forbidding overflow-based optimizations is about 12% geomean perf hit with ~1% size increase, so the standard keeps wrapping undefined but tightens representation.
AI-written summary · about
chapters (19)
- 0:00Introduction to talk
- 0:22Signed integers representations
- 3:55Undefined behavior in practice
- 10:41Clever but broken workarounds
- 14:35Builtins for overflow checks
- 14:55Famous integer overflows
- 24:28Linus Torvalds on undefined behavior
- 28:25Why change the standard
- 30:12Binary number systems history
- 35:50Modern hardware survey
- 36:56Storage vs arithmetic in two's complement
- 38:20Arguments against defining overflow
- 41:58Performance impact of overflow rules
- 43:47Alternative integer types in other languages
- 48:01Proposing changes to the committee
- 51:13Committee feedback and next steps
- 53:04Changes in the standard
- 55:51Future simplifications
- 56:12Q&A session
related talks
01h 01mSigned Integers Considered Harmful
01h 04mBeyond the Floating Point Computations - What’s New, What’s Useful?
39mMitigating Integer Overflow in C
01h 30mDangerous Optimizations in C and C++ Programming Languages
06mArithmetic in C++ Using Counting Pointers
06mLightning Talk: Safe Arithmetic Speed-Run: Experimental C++ Library
01h 19mThis is C++: Uncompromised Performance, Undefined Behavior, & Move Semantics
14mStatic Analysis of Endian Portability by Abstract Interpretation
