KEYNOTE: De-fragmenting C++: Making exceptions more affordable and usable - Herb Sutter [ACCU 2019]

ACCU Conference · 16K views · 2019 · 1:03:56

Open on YouTube

C, C++, Rust, Go & systems languagesProgramming language designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when discussing the cost of C++ exceptions and how contracts and assertions fit into the language's error handling future.

Recommended by 1 people across 1 different months, 2019 to 2025.

What it is

A keynote at ACCU 2019 in which Herb Sutter, chair of the ISO C++ committee, lays out why exception handling has split the C++ community and proposes ways to make exceptions cheaper and more consistent. He separates recoverable errors, programming bugs and resource exhaustion as three distinct categories that should be reported differently.

What people said

Recommends Peter Cordes · 2019-06 · Stack Overflow · on “Why is C++ initial allocation so much larger than C's?”

The fact that enabling exception handling has a cost even if you don't actually use it is a problem. That's not normal for C++ features in general, and it's something that the C++ standards working groups are trying to think of ways to fix. See Herb Sutter's keynote talk at ACCU 2019 De-fragmenting C++: Making exceptions more affordable and usable [this video] . It is an unfortunate fact, though, in current C++. And traditional C++ exceptions will probably always have that cost, even if/when new mechanisms for new exceptions are added with a keyword.

Cites Resurrection · 2019-05 · Stack Overflow · on “Testing against the C++20 contracts (assertions)”

Herb Sutter delivered a talk at ACUU Conference [this video] regarding the future of exceptions in C++ and upcoming contracts to replace or enhance existing assert [LINK] . He postulates the following rules to deal with error handling: System corruption (e.g., stack overflow): terminate Programming bug (e.g. precondition violation): assertions, contracts Recoverable error (e.g., network down): exception, error code While I agree, I am not using this approach and essentially combine the 2 and 3 into one. I do that because I do not know how to test assertions or the upcoming contracts. Both use similar mechanisms that their violation causes the program to terminate and call optional handlers before

Cites Mordachai · 2019-05 · Stack Overflow · on “How to check for and handle precondition violations?”

C++20 is delivering some amazing new features around contracts - which for templates is going to make life much better - where constraints around types or other compile-time requirements can be baked into the template definition and enforced with decent diagnostics by the compiler. Yay! However, I'm very concerned by the push towards terminating unconditionally when a runtime precondition violation occurs. [LINK] A program may be translated with one of two violation continuation modes: off (default if no continuation mode is selected): after the execution of the violation handler completes, std::terminate is called; on: after the execution of the violation handler completes, execution contin

Cites Eternal · 2025-07 · Stack Overflow · on “Why no cleanup if a contract precondition fails?”

That's a very good point, I did not know that... but I do think there is an intent to use contracts to turn exceptions into termination (especially after watching [this video] in which Herb Sutter explains the proposal he submitted for the future of exceptions), and I believe the core of my question still stands