Throwing Exceptions for Fun and Profit
summary
Argues that throwing exceptions can match return-code performance by moving construction and throw logic into a noinline/noreturn helper so call sites stay small and instruction-cache friendly, shows a templated raise<T>(...) with perfect forwarding and attributes that yields assembly nearly identical to a return path, records source file/line via a macro-wrapped source-location capture, and reduces exception-handling overhead by placing the catch outside tight loops so the catch frame is generated only once.
AI-written summary · about
chapters (6)
- 0:00Introduction to Exceptions
- 1:25Reducing Exception Overhead
- 2:37Using Templates for Exceptions
- 3:45Performance Comparisons
- 4:24Tracking Exception Location
- 5:12Best Practices for Catching
related talks
01h 00mUsing Coroutines to Implement C++ Exceptions for Freestanding Environments
01h 01mException-Safe Code, Part I
01h 04mException-Safe Code, Part III
01h 02mOption(al) is not a failure
01h 25mC++ Exceptions for Smaller Firmware
01h 02mEmbracing Trailing Return Types and `auto` Return SAFELY in Modern C++
56mThe Dawn of a new Error
54mModern Template Techniques
