November 12, 2025
Bring popcorn: error handling cage match
Bjarne fix your freaking language
C++ dad shows “safe” code and the comments go nuclear
TLDR: Bjarne’s “Safe C++” example using exceptions reignited a war over how C++ should handle errors. Commenters split between “C++ is broken—see Java/Rust or new syntax” and “the author misused exceptions,” spotlighting how error handling shapes reliability, complexity, and developer sanity.
C++’s creator Bjarne Stroustrup showed a “Safe C++” slide about cleaning up files automatically, and the internet said: sir, step away from the try/catch. His example used exceptions (error-throwing) plus RAII—fancy talk for “objects clean up after themselves.” Critics pounced, saying exceptions make errors fuzzy, hard to catch all, and force awkward code shapes. The author mocked this as RAISI—“Resource Acquisition is Second Initialization”—because you end up initializing twice just to handle errors cleanly.
Then the comments set the room on fire. One camp cheered Java and Rust for “checked” errors—basically, making function contracts admit what can go wrong. Another camp clapped back: the author “misunderstands” exceptions and is swinging at the wrong target. Meanwhile, a drive‑by classic: someone dropped the infamous C++ FQA “ultimate takedown,” calling C++ an “abomination,” and the meme machine did the rest. Folks also proposed a cleaner “try … unless …” syntax so your error handler doesn’t accidentally catch everything.
The vibe? Equal parts love letter and roast. Some want simpler, C‑style “return null if it fails.” Others insist modern C++ is fine—if you use it right. And hovering over it all: Bjarne can’t just “fix it”—C++ is a 200‑person committee. Grab popcorn, toss exceptions, repeat.
Key Points
- •Bjarne Stroustrup’s Safe C++ example uses RAII to manage FILE resources via a File_handle class that throws on fopen failure.
- •The article critiques exceptions for routine errors, citing issues of correctness, exhaustiveness, and scope constraints (RAISI).
- •A C-style approach checks fopen’s return value for NULL and uses errno to report errors before returning.
- •Localizing try/catch to the open step in C++ requires a default-constructible or nullable File_handle, complicating design.
- •Proposed mitigations include wrapping the RAII resource in optional or enhancing the RAII type to support a null state.