Jason Turner explores the complex and surprising corners of object lifetime in C++, challenging common assumptions about RAII and resource management.
CppCon.org
—
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2018
—
One of the main defining features of C++ is that of well defined object lifetime. We know that when a scope exits any local variables will be properly cleaned up. This is something that we rely upon and use regularly for the management of resources (ie RAII).
However, there are some corners of the language that challenge our understanding of object lifetime. I have been teaching classes on understanding object lifetime for over a year now and some of these places continue to surprise my students and have even surprised me.
We will explore these corners of C++ and ask if they cause enough concern that the language features should not be used, or if they are still worth the price? We will also ponder if these can be considered mistakes in the language or just side effects of a useful feature. We will also explore when and how the compiler and analyzers can warn on these issues.
—
Jason Turner
Developer, Trainer, Speaker
Host of C++Weekly youtube.com/c/JasonTurner-lefticus, Co-host of CppCast cppcast.com, Co-creator and maintainer of the embedded scripting language for C++, ChaiScript chaiscript.com, and author and curator of the forkable coding standards document cppbestpractices.com.
I'm available for contracting and onsite training.
—
Videos Filmed & Edited by Bash Films: BashFilms.com
Work at Hudson River Trading (HRT): tinyurl.com/safxfctf
---
Videos Filmed & Edited by Bash Films: BashFilms.com
Why it's here
2 people recommend this
What people say. Recommended as a great talk highlighting the complexities and potential pitfalls of object lifetime in C++.
S
u/Saefrochin r/rust • Recommends
On “Coworker: "Rust doesn't offer anything C++ doesn't already have"”
The primary benefit is memory safety (and thread safety, but per the Rust definition freedom from data races is part of memory safety). Modern C++ does not provide memory safety, it _does_ provide freedom from memory leaks which is something the C++ community has focused a lot on, and I've talked to C++ programmers who think that these issues are the same; that they've solved this memory safety thing because they don't have leaks. I'd make sure your colleague doesn't share this misunderstanding before trying to explain that Rust is all about memory safety.
Modern C++ provides quite a few niceties and in many cases makes memory unsafety bugs marginally harder to write but it does not by any…