A Deep Dive Into C++ Object Lifetimes - Jonathan Müller - C++Now 2024 @CppNow
A Deep Dive Into C++ Object Lifetimes - Jonathan Müller - C++Now 2024  @CppNow
Uploaded September 2024 | Updated December 2026, 3 hours ago
cppnow.org
---

A Deep Dive Into C++ Object Lifetimes - Jonathan Müller - C++Now 2024
---

A C++ program manipulate objects, but it is undefined behavior if you attempt to manipulate them while they are not alive.
So let's do a deep dive into object lifetime.

When are objects created and when are they destroyed?
How does temporary lifetime extension come into play and what changed there recently?
What happens when you std::malloc memory and just pretend objects are there without creating anything?
Or worse: You use mmap() to read shared memory.
How do unions interact with constructors, strict aliasing, or the "common initial sequence"?
What when you explicitly call the destructor and later re-use the same storage?
What's the deal with std::launder, std::bit_cast, and std::start_lifetime_as?

We'll answer all of those questions and much more.
We'll do that by looking at the C++ standard, old and new proposals, and compiler optimizations.
---

Slides: github.com/boostcon/cppnow_presentations_2024/blob/main/Presentations/An_(In-)Complete_Guide_to_Cpp_Object_Lifetimes.pdf


---

Jonathan Müller

Jonathan is a library developer at think-cell. In his spare time, he works on various C++ open source libraries for memory allocation, cache-friendly containers, or parsing. He also blogs at foonathan.net and is a member of the C++ standardization committee.
---

C++Now 2025 - 28th April - 2nd May
C++Now is an annual onsite international C++ programming and coding conference held in Aspen, Colarado. For all C++ developers, C++ software engineers and those involved with the C++ language, CppNow provides an indepth and technical content provided by the best and brightest C++ experts of the C++ world.
Annual CppNow Conference - cppnow.org
linkedin.com/company/cppnow
twitter.com/cppnow
facebook.com/CppNow
reddit.com/r/CppNow
https://mastodon.social/@cppnow
Video Sponsors: millennium and think-cell
---

Videos Filmed & Edited By Bash Films: bashfilms.com
YouTube Channel Managed & Optimized By Digital Medium Ltd: events.digital-medium.co.uk
---

#boost #cpp #cppprogramming #cplusplus #software development
A Deep Dive Into C++ Object Lifetimes - Jonathan Müller - C++Now 2024C++ Type Erasure Demystified - Fedor G Pikus - C++Now 2024Lightning Talk: The Average Lies: A 5-Minute Lesson in Tail Latency - Sampad Acharya - C++Now 2026Parallel Range Algorithms - The Evolution of Parallelism in C++ - Ruslan Arutyunyan - C++Now 2025Beyond Sequential Consistency - Leveraging Atomics for Fun & Profit - Christopher Fretz  C++Now 2025C++ Should Be C++ - David Sankel - C++Now 2024Exclusive Interview With C++Now 2024 Program Chair Inbal Levi with @cppevents!Lightning Talk: Organic Evolution of Reflection in Apache Thrift  - Shai Szulanski - C++Now 2026The C++ Vector Challenge - Lisa Lippincott - C++Now 2024Lightning Talk: Finding My First Compiler Bug - Braden Ganetsky - CppNow 2023Lightning Talk: Debugging Like House - Software Differential Diagnosis - Michael Okyen - C++Now 2024Guide to Random Number Generation in C++ - Adrien Devresse - C++Now 2024
CppNow |

A Deep Dive Into C++ Object Lifetimes - Jonathan Müller - C++Now 2024

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER