Typical C++, But Why?
summary
Argues that small, concrete types and C++20 features turn runtime surprises into compile-time errors: a SanitizedString wrapper makes using unsanitized input a compile error via an explicit constructor and conversion operator; replace multiple bool flags with enum class flags to prevent parameter mixups; model pointer+length as a single buffer_view/span to avoid off-by-header arithmetic; use a must_init<T> pattern (no default ctor) and the spaceship operator to force initialization and safe comparisons.
AI-written summary · about
chapters (19)
- 0:00Welcome
- 1:33C++ type systems
- 4:41Argument passing in C++
- 5:04Wrong argument usage
- 9:45Sanitized string approach
- 12:15Loadable parameters anti-pattern
- 16:15Default parameters dangers
- 20:40Coupled parameters issue
- 27:24Buffer views for memory
- 30:34Socket server configuration
- 34:54Must-init template
- 37:24Wrong key types in maps
- 41:20Strong types with enum class
- 44:11Type creation patterns
- 46:20Expressive APIs in C++20
- 47:25Refuting code rot
- 48:54Further resources
- 50:21Closing remarks
- 50:43Q&A: Core Guidelines
related talks
51mTypical C++, but Why?
01h 13mType safe C++ – LOL! :-)
01h 36mBuilding C++ Interfaces That Are Hard to Use Incorrectly
58mHow to Build Cpp Interfaces That Are Hard to Use Incorrectly
01h 33mSafe and Sane C++ Types
15mC++ WAT
51mThe C++ Type System is your Friend
59mBuilding Cpp Interfaces That Are Hard to Use Incorrectly
