Exception safety, properly. And the same problem under a dozen other names.
Read online at cloudstreet-dev.github.io/Exceptionally-Unsafe
Exceptions are invisible GOTOs to unguessable destinations. Most working engineers cannot precisely state the difference between the no-throw guarantee, the basic guarantee, and the strong guarantee — and most code that claims one provides another. This book fixes the vocabulary, shows the mechanics, and then drags the same problem out of every dark corner it likes to hide in: concurrent code, smart-contract reentrancy, signal handlers, kernel interrupts, database transactions, distributed sagas.
The reader is assumed to already know what try and catch look like. The book starts where most books stop.
Code in C++ where the language is the canonical battleground, with Java, Python, C#, Rust, Go, JavaScript, and Common Lisp where the language matters. Chapter 6 is Common Lisp — non-negotiable, because the condition system makes possible things try/catch cannot.
- Introduction
- The Invisible GOTO
- The Three Guarantees
- RAII (and What It Doesn't Solve)
- Strong Guarantee Patterns
cargo install mdbook
mdbook serve --openCC0 1.0 Universal — public domain dedication. Take it, fork it, ship it, claim it as your own. See LICENSE.