Back to Basics: C++ API Design
summary
Argues for concrete rules: mark getters no discard, mark non‑throwing functions no accept, prefer returning unique_ptr or an expected‑style type over raw pointers, avoid implicit conversions and delete dangerous overloads, pick one in‑band error strategy (exceptions or std::expected / "stood expected"), make factory semantics explicit, and run sanitizer‑backed fuzzers against the API to find real misuse. Examples include vector.empty, fopen mode parsing, and factory return patterns.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 3:52Make your API hard to use wrong
- 8:08Understanding [[nodiscard]]
- 17:38Error handling with [[noexcept]]
- 23:19Factory functions and ownership
- 32:53No raw pointers and error handling
- 41:51Avoid implicit conversions
- 51:01Compile-time safety tricks
- 59:05Fuzzing API robustness
related talks
39mBack to Basics: The Rule of Five in C++
01h 40mBack to the Basics! Essentials of Modern C++ Style
01h 30m50 shades of C++
01h 04mException-Safe Code, Part III
01h 01mException-Safe Code, Part I
50mBack to Basics: Smart Pointers and RAII
59mBack to Basics: Generic Programming in C++
01h 05mBack To Basics: Overload Resolution
