~/talk

A Deep Dive Into C++ Object Lifetimes

Talkat C++Now 2024 · 2024-04-29..05-03· [compilers-and-language-design]
links:none on file
slides:none on file

Detailed survey of where C++ lifetimes actually start and end, with concrete rules and recent changes: std::start_lifetime_as for safely claiming malloc/mmap bytes, std::launder and std::bit_cast limitations for provenance and strict-aliasing, placement new plus explicit destructor semantics, temporary-lifetime extension quirks, and the C++20 implicit-object-creation fix (and C++26’s move from UB to erroneous for uninitialized reads). Plenty of counterexamples showing when pointer/register optimizations break, where unions and const heap objects bite, and which compiler assumptions cause real bugs.

AI-written summary · about

  1. 0:00Introduction to object lifetimes
  2. 8:28Storage duration and lifetime basics
  3. 16:33New, delete and placement new
  4. 23:59Temporary objects and lifetime extension
  5. 36:25Implicit object creation
  6. 46:00Object reuse and transparent replacement
  7. 57:41Pointer provenance and laundering
  8. 1:06:34Type punning rules
  9. 1:13:13Invalid pointers and zombie pointers
  10. 1:19:33Guidelines and conclusion
  11. 1:28:04Q&A and closing
~/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.