~/talk

C++ Object Lifetimes - Objects and Lifetimes in C++ Explained

Talkat C++ on Sea 2024 · 2024-07-02..07-05· [software-architecture]
links:none on file
slides:none on file

Concrete rules for when an object’s lifetime actually starts and ends, and when the compiler can assume it never happens, are explained with examples: placement new and explicit destructor calls for manual lifetimes, implicit object creation (the “time‑travel” model) for malloc/reuse and memcpy, temporary lifetime extension rules and the loop/for‑range fix in C++20/C++23, provenance aka pointer history that breaks naïve pointer arithmetic, union active‑member and common‑initial‑sequence exceptions, and when to use std::launder, std::bit_cast, or std::start_lifetime_as to avoid UB.

AI-written summary · about

  1. 0:00C++ object lifetimes intro
  2. 4:16Object storage basics
  3. 11:38Manual new/delete
  4. 18:43Temporary objects
  5. 26:53Placement new
  6. 31:52Implicit object creation
  7. 46:10Pointer provenance
  8. 57:27Type punning
  9. 1:04:19Invalid pointers
  10. 1:09:37Best practices
~/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.