Perspectives on Contracts for C++
summary
A concrete proposal (P2900) aims to add contracts to C++26 with fuller support in C++29, specifying preconditions, postconditions, and contract assert and a per-translation-unit model that gives three checkboxes per translation unit (off / detective / hard‑hat) so compilers can choose enforcement location. The design accepts double-checked assertions, allows sampling, relies on devirtualization when available, treats termination as implementation‑defined, and admits one awkward API case still unresolved.
AI-written summary · about
chapters (9)
- 0:00Contracts in C++
- 2:32Assertions and redundancy
- 8:35C++ assertion behavior
- 15:00Preconditions and postconditions
- 21:02Assertion modes
- 26:00Ensuring assertions do nothing significant
- 33:09Debugging assertions
- 39:59Perspectives on contracts
- 41:28Q&A
related talks
01h 02mContracts in C++26 - An Insider's Overview
01h 32mContracts for C++
56mContracts for Dependable C++
01h 05m“Contract Programming in C++(20) (part 2 of 2)”
01h 03m“Contract Programming in C++(20) (part 1 of 2)”
01h 17mFunction Contracts in Practice using C++
01h 27mContractual Disappointment in C++
01h 31mWhat C++ Needs to be Safe
