~/talk

Signed Integers Considered Harmful

Talkat NDC TechTown 2022 · 2022-08-29..09-01· [c-and-cpp]
slides:none on file

Argues that counts and sizes should be unsigned by default, not signed, because unsigned avoids expensive checks and more predictable semantics for counts; shows a common infinite-loop bug when counting down a size_t that wraps, and fixes with a do/while or proper unsigned logic; runs SPEC-like tests (bzip) on GCC/Clang/ICC finding size_t fastest versus int32/uint32; demonstrates diagnostics with UBSan / -fsanitize=unsigned-integer-overflow and cites David LeBlanc’s safeint results.

AI-written summary · about

  1. 0:00Introduction
  2. 1:10Unsigned usage motivations
  3. 3:17Signed in loops
  4. 11:26Unsigned wraparound problems
  5. 22:07Why unsigned makes sense
  6. 31:47Critique of Google C++ style
  7. 41:14Signed overflow undefined
  8. 51:06Unsigned performance and correctness
  9. 56:01Choosing variable types
  10. 1:00:42Summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.