Catching Bugs Early: Validating C++ Contracts with Static Analysis - Peter Martin & Mike Fairhurst @CppCon
Catching Bugs Early: Validating C++ Contracts with Static Analysis - Peter Martin & Mike Fairhurst  @CppCon
Uploaded December 2025 | Updated November 2026, 5 hours ago
cppcon.org
---

Catching Bugs Early: Validating C++ Contracts with Static Analysis - Peter Martin & Mike Fairhurst - CppCon 2025
---

The recent acceptance of contracts into the draft standard for C++ 26 promises to help create safer programs by supporting preconditions, postconditions and assertions that can be validated at runtime to ensure fast failure in case of error. However, nobody likes programs that unexpectedly terminate, and fixing faults earlier in the development lifecycle is significantly cheaper than later, so a question arises—can we check these contracts before the program is run?

In this talk we will show how contracts as specified in C++ can in many cases be validated at compile-time using static analysis tools. We will talk about which contracts are amenable to such analysis, and what theoretical and practical limitations exist. To validate these ideas, we’ll demonstrate an implementation in CodeQL – GitHub’s extensible static analysis engine – combined with a constraint solver to validate certain types of contracts. Finally, we’ll present results from a case study evaluating the effectiveness of these techniques on real-world contracts and code bases.

---

Slides: github.com/CppCon/CppCon2025/blob/main/Presentations

Work at Hudson River Trading (HRT): tinyurl.com/safxfctf
---

Peter Martin

Peter Martin leads the Security Automation team in the Product Security group within the CISO Office at Bloomberg. His team focuses on large-scale code analysis and automation to improve software security at scale.

Peter joined Bloomberg in 2007 and spent a decade in the company's Engineering department in a variety of roles, working on everything from low-level systems programming to mobile applications and middleware.

Prior to moving into his current role, he spent the last eight years specializing in software security research and strategy as a Technical Architect in the firm's CTO Office.

Peter holds a master's degree in computer science from the University of Bristol.

Mike Fairhurst

Mike Fairhurst is an expert in static analysis and programming language tooling and a Senior CodeQL Analysis Engineer at GitHub. At GitHub he has worked on C/C++ static analysis using CodeQL including implementing MISRA C/C++ compliance analysis.

Before GitHub, Mike previously worked on the Dart analyzer + language server at Google, and in personal projects Mike has created a JIT-compiled language called Vaiven, and a statically typed Alt-JS language with type inference and testability guarantees called Wake.
---

CppCon is the annual, week-long face-to-face gathering for the entire C++ community. The conference is organized by the C++ community for the community. You will enjoy inspirational talks and a friendly atmosphere designed to help attendees learn from each other, meet interesting people, and generally have a stimulating experience. Taking place this year in Aurora, Colorado, near the Denver airport, and including multiple diverse tracks, the conference will appeal to anyone from C++ novices to experts.
Annual CppCon Conference - cppcon.org
linkedin.com/company/cppcon
https://x.com/cppcon
facebook.com/CppConference
reddit.com/r/cppcon
https://mastodon.social/@CppCon
---

Videos Filmed & Edited by Bash Films: BashFilms.com
YouTube Channel Managed by Digital Medium Ltd: events.digital-medium.co.uk
---

#contracts #debugging #cpp #cplusplus #programming #coding #softwareengineering #softwaredeveloper #code #cplusplusprogramming #cplusplustutorial #cplus #softwaredevelopment
Catching Bugs Early: Validating C++ Contracts with Static Analysis - Peter Martin & Mike FairhurstLightning Talk: The Lifecycle of This CMake Lightning Talk - Yannic Staudt - CppCon 2025Compiler Explorer: The Features You Never Knew Existed - Matt Godbolt - CppCon 2025Profiles for Simplicity and Guarantees - Bjarne Stroustrup - CppCon 2026Lightning Talk: Micro C++ Benchmarks & Murphys Law - Lexington Brill - CppCon 2024Work Contracts in Action: Advancing High-performance, Low-latency Concurrency - Michael ManiscalcoLightning Talk: C++ in the Cloud: One NIF at a Time with Elixir - Sakshi Verma - CppCon 2024Lightning Talk: Saturday Is Coming Faster - Convert year_month_day to Weekday Faster - Part 1Beyond Sequential Consistency: Unlocking Hidden Performance Gains - Christopher Fretz - CppCon 2025Dynamic Asynchronous Tasking with Dependencies - Tsung-Wei (TW) Huang - CppCon 2025Mastering the Code Review Process - Pete Muldoon - CppCon 2025The Dangers of C++: How to Mitigate Them and Write Safe C++ - Assaf Tzur-El
CppCon |

Catching Bugs Early: Validating C++ Contracts with Static Analysis - Peter Martin & Mike Fairhurst

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER