Herb Sutter delivers a presentation about contracts in C++, particularly focusing on the draft C++26 standard. He begins by acknowledging the contributions of various experts in the field and sets the stage by addressing the differing opinions on the readiness of C++26 contracts. The talk covers the motivation behind contracts, emphasizing functional safety versus type and memory safety, and illustrates the use of contracts with practical examples, including a critique of an AI-generated code snippet. Sutter explains the four contract semantics—ignore, observe, enforce, and quickenforce—and discusses best practices for using contracts effectively, such as avoiding side effects and understanding the implications of build modes. He also addresses frequently asked questions and open concerns about the design, including implementation-defined behaviors and potential runtime costs, while advocating for the value and future extensibility of the minimum viable product approach taken by the committee.
Sign in to continue reading, translating and more.
Continue