~/talk

Building C++ Interfaces That Are Hard to Use Incorrectly

Talkat ACCU 2023 · 2023-04-19..04-22· [c-and-cpp, api-design]
slides:none on file

Collection of concrete techniques that push precondition checks from run-time to compile-time using the C++ type system: use scoped enums and tag‑typed opaque handles to prevent mixing unrelated integers, wrap pointer+size as span or a small struct with C++20 designated initialization to avoid swapped args, prefer declarative formats over fiddly offsets for vertex/graphics data, use std::visit with an overload wrapper to force exhaustive variant handling, encode nullable or NUL‑terminated strings with GSL types, enforce contexts with access/execution tokens, and adopt std::expected (C++23) for clearer error paths.

AI-written summary · about

  1. 0:00Introduction
  2. 1:04Robust library interface design
  3. 6:29Precondition violations
  4. 17:37Incorrect usage patterns
  5. 25:24Preventing misuse with types
  6. 30:01OpenGL API with scoped enums
  7. 37:58Opaque types with scoped enums
  8. 41:58Advanced opaque type patterns
  9. 48:19Function arguments clarity
  10. 55:48Structured data with std::variant
  11. 1:04:26Null safety and strings
  12. 1:08:46Privileged access tokens
  13. 1:13:00Declarative API design
  14. 1:20:12Two-phase initialization
  15. 1:25:10Execution tokens
  16. 1:30:30Summary
~/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.