~/talk

C++ Contracts: a Meaningfully Viable Product

Talkat CppNorth 2025 · 2025-07-21..07-23· [c-and-cpp, software-architecture]
slides:none on file

C++26 ships a pre/post/contract assert model with concrete rules: pre/post attach to the first declaration, repeated specs must be token-equivalent (no lambdas), post can name the return, and by-value parameters used in post must be const. Contracts run in a defined order (params init, pres, body, result init, post) and choose one of four semantics ignore/observe/enforce/quick_enforce. Violations call a global handle_contract_violation or terminate, and some checks are required at compile time.

AI-written summary · about

  1. 0:00Introduction to C++26 contracts
  2. 2:03Background and controversies
  3. 3:50Contract types and keywords
  4. 9:13Bikeshedding and naming history
  5. 12:34Syntactic restrictions and repetition
  6. 15:25Constification and side effects
  7. 26:12Postconditions and return values
  8. 29:06By-value parameters in postconditions
  9. 31:18Contract evaluation order
  10. 33:28Contract semantics overview
  11. 36:38Semantics selection and compliance
  12. 39:32Elision and duplication rules
  13. 43:05Violation handler details
  14. 47:43Custom violation handlers
  15. 51:17Prime directive and exceptions
  16. 53:30Contract assert limitations
  17. 54:13Future of contracts and thanks
  18. 55:51Q&A session begins
  19. 1:07:40Final Q&A and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.