How Go Avoided the Integer Promotion Footgun
summary
Explains why Go avoids the C-style integer promotion footgun by making literal numbers untyped constants so 1<<32 can represent 4GB without truncation on 64-bit platforms and cause a compile-time error instead of undefined wraparound on smaller words; shows C examples where int-typed literals produce surprising results (e.g. signed char wrapping to -128, 256 truncating to 0) and demonstrates typed constants with methods to encode units rather than rely on suffixes like 0x80ULL.
AI-written summary · about
chapters (8)
- 0:00Start
- 4:13Mark 1 fire control computer 1940ish
- 5:09IBM 407 Accounting Machine 1949
- 9:45Control Data 6600 1964
- 12:49BPCL Martin Richards, 1967
- 13:41B Ken Thompson, 1969
- 16:03Computers evolved various word sizes for market segmentation reasons
- 17:34The C Programming Language First Edition, 1978








