~/talk

Object Lifetime in C++: From Start to Finish

Talkat CppNorth 2023 · 2023-07-17..07-19· [software-architecture]
slides:none on file

Covers concrete rules: object lifetime starts when storage is obtained and non‑vacuous initialization completes, ends when destructor runs or storage is released; temporaries die at the end of the full expression except when bound to a reference (lifetime extension). Demonstrates RAII patterns, shows return value optimization and named RVO (clang often elides, GCC sometimes emits moves), warns about dangling references from returning member refs, reproduces behavior on Godbolt and uses C++ Insights to show range‑for desugaring; range‑for UB is fixed in C++23.

AI-written summary · about

  1. 0:00Introduction to object lifetime
  2. 2:53Storage duration basics
  3. 8:09Constructors destructors examples
  4. 15:16RAII and resource management
  5. 18:51Tricky parts of object lifetime
  6. 21:00Return value optimization
  7. 27:44Dangling references explained
  8. 34:06Lifetime of temporaries
  9. 41:42Lifetime extension rules
  10. 48:13Range-based for loop pitfalls
  11. 53:31Summary 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.