By Blog Staff | Jun 30, 2026 03:13 PM | Tags: None

sutter-joy.pngRegistration is now open for CppCon 2026! The conference starts on September 12 and will be held in person in Aurora, CO. To whet your appetite for this year’s conference, we’re posting videos of some of the top-rated talks from last year's conference. Here’s another CppCon talk video we hope you will enjoy – and why not register today for CppCon 2026!

The Joy of C++26 Contracts - Myths, Misconceptions & Defensive Programming

by Herb Sutter

Summary of the talk:

This talk is all about the C++26 contracts feature. It covers the following topics:

  • Why defensive programming is a Good Thing (mainly for functional safety, but occasionally also for memory safety)
  • Brief overview of C++26 contracts, and why they’re way better than C assert (spoiler: writing them on declarations, being able to use them in release builds, and language support is just way better than macros)
  • The 3-page “Effective C++ Contracts book” — best practices you need to know to use them (spoiler: keep compound conditions together, don’t write side effects, understand the pros and cons of installing a throwing violation handler… that’s pretty much… it?)
  • Why they’re viable, because they address the key things we need in production (which we’ll list)
  • Why they’re minimal, because we actually need every part in C++26 to use them at scale (which we’ll do by systematically summarizing why each piece is necessary)
  • What the future evolution of contracts holds (spoiler: virtual functions! groups/labels!)
  • A review of Frequently Asked Questions