~/talk

int != safe && int != ℤ

Talkat Meeting C++ 2025 · 2025-11-06..11-08· [security]
slides:none on file

C++ int is shown to be unsafe: undefined behaviour on overflow and divide‑by‑zero, MISRA static checks miss cases, and plain promotions create surprising signed/unsigned flips. Implements three single-header libraries (modular wrap, overflow-detecting integers that raise or throw, and saturation arithmetic), uses GCC/Clang builtins or 64‑bit widen checks, reports multiplication overflow ≈99.99999% for random ints, demonstrates enum class has no codegen penalty while class return can force stack on MSVC, and adds SFINAE compile‑time checks.

AI-written summary · about

  1. 0:00Introduction
  2. 1:46Int not safe in programming
  3. 3:50C++ int definition limits
  4. 10:00Undefined behavior with integer operations
  5. 17:21Probability of undefined behavior
  6. 24:38Consequences in practice
  7. 29:18Safer integer arithmetic
  8. 33:35Three safer integer approaches
  9. 35:41Overflow detection integers
  10. 42:17Detecting overflow in addition and multiplication
  11. 46:14Safer integer types
  12. 50:38Compile-time constraints testing
  13. 52:45Saturation arithmetic
  14. 56:20Conclusion and key takeaways
~/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.