~/talk

Programming with Contracts in C++20

Talkat ACCU 2019 · 2019-04-10..04-13· [c-and-cpp, compilers-and-language-design]
slides:none on file

C++20 adds contract attributes (examples: expects/ensures/assert attributes) but with important limits: postconditions cannot refer to the pre-call state (no general old), invariants are effectively absent, function pointers and callbacks cannot carry contracts, and virtual overrides must repeat the same contract list. Checks run where the function is defined (contracts checked inside callee), build levels (OFF/DEFAULT/AUDIT) are per translation unit, violation handlers exist and by default lead to terminate. A Clang fork proof‑of‑concept implements this and demonstrates the behaviors and pitfalls.

AI-written summary · about

  1. 0:00Intro
  2. 0:15Welcome
  3. 1:22What are contracts
  4. 3:50How I learned about contracts
  5. 4:40Systematic approaches to program construction
  6. 6:57Ring Buffers
  7. 9:00Precondition
  8. 10:58Preconditions
  9. 17:52Postcondition
  10. 24:46Exceptions
  11. 26:04Post Conditions
  12. 26:46Contract Logic
  13. 29:30Invariants
  14. 30:02Portrait specialization
  15. 31:42Specializations
  16. 32:53Subcontractors
  17. 34:10Why bother
  18. 35:24Contract Violations
  19. 39:26Science Fiction
  20. 39:53The Draft Standard
  21. 41:01Contract Attributes
  22. 48:41Contract Attributes Example
~/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.