📖 Book · cpp core · high
⚙️ Stack unwinding & exception safety
How exceptions unwind the stack (running destructors), why that powers RAII, and the safety rules.
What happens when an exception is thrown: the stack unwinds, destroying local objects in reverse order until a matching handler is found — runnable demos of destructor order and RAII cleanup. Plus the throw-in-destructor terminate trap (and implicit noexcept destructors) and the nothrow/strong/basic exception-safety guarantees.
5 chapters▶ runnable code✦ in-depth animation
What this book covers
- 01What stack unwinding is
- 02Destructors run in reverse order — run it
- 03RAII: why C++ needs no `finally` — run it
- 04The throw-in-destructor trap → terminate
- 05Exception safety guarantees
Read it in full — runnable C++ + step-through animations
Every chapter of Stack unwinding & exception safety ships complete, editable code you compile and run in the browser, plus the same in-depth animations as the lessons.