Type safe C++? LOL!
summary
A bug mixes two uint32 IDs and fails to compile until each becomes a distinct strong type, so code prevents using a request ID vs receiver ID bug at compile time; a simple safe_type template (tagged typedefs / CRTP macro) proves practical. The talk demos github libraries typesafe::strong_type and named_type, shows 24‑bit slot‑count serialization, and measures zero overhead — sometimes faster due to aliasing rules.
AI-written summary · about
chapters (11)
- 0:00Start
- 1:54Type Safety the Extent to Which a Programming Language Discourages or Prevents Type Errors
- 15:01Typesafe Library
- 22:02Questions
- 23:44Slot Ranges
- 27:10Encapsulation
- 28:04Overload Functions
- 33:50Pointer Arithmetic
- 34:26Affine Space
- 35:30Test Code
- 43:39Aliasing
related talks
54mA Tour of C++ Recognised User Type Categories
01h 10mType Deduction and Why You Care
49mTypical C++, But Why?
34mTypes Are Not Safe
05mLightning Talks: -std=c++20 -- Will This C++ Code Compile?
34mType Your Business
01h 11mC++20 Templates: The next level: Concepts and more
21mThe long-tail of type safety
