Contracts programming after C++17
summary
Proposal targets C++20 and adds language-level contracts with new attributes expects/ensures/assert, three assertion levels default/audit/axiom and three build modes that control checking. Default on violation is program termination, toolchain can install a global violation handler and enable a continuation mode that resumes execution (undefined behavior if optimized away). Contracts are annotations (not part of function type), must match across declarations and overrides, work with templates and lambdas, and implementations are pending; use GSL as a today workaround.
AI-written summary · about
chapters (20)
- 0:00Start
- 4:13Why correctness?
- 6:39Why are we here?
- 10:54Contracts in C++
- 13:54Correctness and Robustness
- 15:44Exceptions in use
- 19:03Robustness in the C++ standard library
- 23:22Correctness and contracts
- 24:30Correctness in the C++ standard library
- 25:15Can we do it better?
- 29:17What is a contract?
- 30:22Expectations
- 32:33Assurances
- 34:38Assertions
- 43:05Effect of contracts
- 49:18Repeating a contract
- 51:49Assertion level
- 53:16Audit checks
- 54:19Axiom checks
- 57:50Build levels
related talks
01h 21mProgramming with Contracts in C++20
54mC++ Concepts for Developers
01h 26mC++26 Preview
58mExploration of C++20 Meta Programming
01h 39m“Concepts: The Future of Generic Programming (the future is here)”
01h 23mCarbon Language: An experimental successor to C++
37mDealing with aliasing using contracts
01h 01m“Concepts and Contracts: When, What, and How”
