By Herb Sutter
Error handling has fractured the C++ community into incompatible dialects, because of long-standing unresolved problems in C++ exception handling. Many projects turn off exception handling (EH) entirely, such as with -fno- except. Many others don’t throw exceptions in code that has to run in statically bounded space or time. Still others don’t know exceptions in code that may not be exception-safe, because they cannot see the invisible exceptional control flow paths.
This talk summarizes the root causes and presents some early proposed solutions that we hope will let the community embrace using exceptions consistently for unified error handling. It also discusses the differences between program-recoverable errors (e.g., database connection dropped), program bugs (e.g., precondition violation), and exceeding resource limits (e.g., stack overflow) to demonstrate why these are three fundamentally different things with different audiences, and therefore should be reported in different ways. The talk will also cover what’s already going on in C++ standardization today to evolve the standard library in these directions, including what’s now already in C++20 to lay the groundwork for these coming changes.