Herb Sutter discusses proposals to simplify C++ and introduces the lifetime profile static analysis tool to prevent dangling pointers.
CppCon.org
—
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2018
—
Perhaps the most important thing we can do for C++ at this point in its evolution is to make sure we preserve its core strengths while also directing its evolution in ways that make it simpler to use. That is my own opinion at least, so this talk starts with a perspective question: What “is C++,” really? The language continues to evolve and change; as it does so, how can we be sure we’re picking C++ evolutionary improvements that not only don’t lose its “C++-ic” qualities, but make it a better C++ than ever?
At recent CppCons, I’ve spoken about several of my own personal C++ evolution efforts and experiments, and why I think they’re potentially important directions to explore for making C++ both more powerful and also simpler to use. The bulk of the talk is updates on two of these:
1. Lifetime and dangling: At CppCon 2015, Bjarne Stroustrup and I launched The C++ Core Guidelines in our plenary talks. In my part starting at , I gave an early look at my work on the Guidelines “Lifetime” profile, an approach for diagnosing many common cases of pointer/iterator dangling at compile time, with demos in an early MSVC-based prototype. For this year’s CppCon, I’ll cover what’s new, including:
• use-after-move diagnoses
• better support for the standard library out of the box without annotation
• more complete implementations in two compilers: in MSVC as a static analysis extension, and in a Clang-based implementation that is efficient enough to run during normal compilation
• the complete 1.0 Lifetime specification being released on the Guidelines’ GitHub repo this month
I’ll summarize the highlights but focus on what’s new, so I recommend rewatching that talk video as a refresher for background for this year’s session.
2. Metaclasses: In my CppCon 2017 talk, I gave an early look at my “metaclasses” proposal to use compile-time reflection and compile-time generation to make authoring classes both more powerful and also simpler. In this case, “simpler” means not only eliminating a lot of tedious boilerplate, but also eliminating many common sources of errors and bugs. For this year, we’ll cover what’s new, including:
• an update on the Clang-based implementation, which now supports more use cases including function parameter lists
• new examples, including from domains like concurrency
• an updated P0707 paper, with more links to working examples live on Godbolt, being posted in the next few weeks for the pre-San Diego committee mailing
—
Herb Sutter
Microsoft
Author, and chair of the ISO C++ committee.
—
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
1 person recommends this
What people say. Recommended for its clear explanation of the C++ lifetime profile and the -Wlifetime flag.
M
Matthieu Brucheron Stack Overflow • Recommends
On “the purpose of the -Wlifetime flag?”
This flag analyzes the local file to see if the code may use pointers to objects that are dead.
You can see Herb Sutter cppcon video on YouTube where he explains this very well: link to this video