~/talk

Contracts in C++26 - An Insider's Overview

Talkat C++ on Sea 2025 · 2025-06-23..06-25· [c-and-cpp, software-architecture]
slides:none on file

After two decades of work the Contracts MVP is confirmed for C++26 (P2900 with rationale P2899) and specifies concrete syntax like pre(...) for preconditions, contract assert as a statement (not an expression), and postconditions that can name the return value. It bans lambdas in repeated contracts, requires const for by-value parameters ODR-used in postconditions, and defines four semantics (observe/enforce/quick_enforce/ignore) plus a replaceable link‑time handler handle_contract_violation. Implementations may evaluate assertions multiple times or elide them.

AI-written summary · about

  1. 0:00C++26 contracts intro
  2. 10:15Contracts terms and types
  3. 13:52Constification controversy
  4. 23:06Post conditions and returns
  5. 27:46Post param const limits
  6. 28:07Contract evaluation order
  7. 31:19Contract evaluation semantics in detail
  8. 36:21Semantics selection freedom
  9. 39:10Elision and side effects
  10. 44:48Violation handlers role
  11. 51:17Exceptions in handlers
  12. 54:13noexcept and assertions
  13. 57:25Assert as statement vs expr
  14. 59:13Summary and future
~/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.