Nathan Myers: Progress on Contract Support for C++17
Channel: CppNow
Date: 14/07/2016

Contract Support in a language helps library authors and library users work together to make better programs, catching usage mistakes early, preventing spurious bug reports, improving security and performance. 

Every library has incidental behaviors and interpretations of arguments that are not in the specification, and could easily be different in the next release. It is very easy to come to accidentally depend on these incidental details. When details can be spelled out directly in C++, and automatically verified during testing, there is much less room for misunderstandings.

The process of getting contract support into C++ has been long and contentious, because the name actually refers to several nearly disjoint goals, with different champions, and conflicting priorities. Some are most interested in static, compile-time verification, others in runtime checking and controlled response to violations, defense against security abuses, or improved optimization opportunities. The annotations programmers would add could certainly be used for all of these things, but where to add them and what to say vary by the intended use. 

The factions have come together to present a common proposal meant to address all the disparate needs, with the minimum burden on programmers. This presentation explores the unified proposal and how it meets the needs of each group, and of programmers in general. Many surprises surfaced while merging the designs and simplifying.
---

*--*

---