~/talk

Practical Tips for Safer C++

Talkat CppNorth 2024 · 2024-07-21..07-24· [security]
slides:none on file

C++ currently allows undefined behavior (UB) that breaks reasoning and optimizations; signed integer overflow is UB while unsigned wraps, and compilers provide options like -fwrapv or sanitizers such as -fsanitize=signed-integer-overflow and unsigned-integer-overflow to detect or change semantics. Use std::strong_order for total float ordering, prefer container::at over operator[] (span gains at in C++26), and prefer high-level algorithms or checked helpers (flux offers flux::ref, flux::mut_ref, read_at/read_at_unchecked) to avoid iterator invalidation from push_back. Use constexpr + static_assert for compile-time UB checks, run UBSan/ASan/MSan/TSan, and note 29% of C++ devs report no unit tests.

AI-written summary · about

  1. 0:00Introduction
  2. 2:19Defining safety
  3. 3:11Undefined behavior
  4. 4:30Disclaimers and resources
  5. 4:55Numeric safety
  6. 7:58Bounds safety
  7. 24:59Memory safety
  8. 36:15Importance of testing
  9. 55:11Constexpr and final thoughts
~/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.