~/talk

Building Cpp Interfaces That Are Hard to Use Incorrectly

Talkat CppNorth 2023 · 2023-07-17..07-19· [c-and-cpp, software-architecture]
slides:none on file

C++ interfaces become harder to misuse by encoding preconditions in types: replace loose GLenum/ints with enum class handles or small wrapper structs (tagged strong types), use structs or designated initializers instead of ambiguous argument lists, enforce limited access with the passkey idiom, and model allowed state transitions by consuming and returning distinct types or cheap execution tokens; examples include GL/Vulkan command-recording and iterator/container invalidation, and tools like clang-tidy catch use-after-move or dead-state uses.

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 1:50Precondition violations explained
  3. 4:38Invalid arguments vs invalid context
  4. 21:57Type system as a prevention tool
  5. 23:42Strong types for OpenGL
  6. 29:16Opaque type definitions
  7. 32:31Structured arguments and data
  8. 35:41Handling variants safely
  9. 38:54Limited friendship with passkey
  10. 41:43Declarative interfaces
  11. 44:29Modeling state through types
  12. 47:01Execution tokens
  13. 50:54State modeling in Vulkan
  14. 54:26Trade-offs and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.