Enhancing Safety in C++ Code With Modern C++ Quantities and Units Library
summary
Shows a concrete library, mp-units, built for C++20 that enforces compile‑time unit safety, models quantity kinds and quantity_spec trees, and keeps zero runtime or size overhead (assembly matches raw doubles). Demonstrates GCC/Clang support while MSVC currently fails, catches unit-mix bugs that caused Mars Climate Orbiter and historical 31% navigation errors, prevents truncation and invalid point math, and surfaces mistakes as compile errors though integer division and unsafe numeric types remain user risks.
AI-written summary · about
chapters (10)
- 0:00C++ safety and units
- 12:01Unit conversion disasters
- 21:09System of quantities and units
- 38:38Safe unit conversions
- 45:49Columbus navigation error
- 54:09Dangers in legacy durations
- 59:27Quantity kinds and type safety
- 1:09:30Fine space points examples
- 1:17:40Pitfalls and trade-offs
- 1:28:36Summary
related talks
01h 03mHow to Improve the Safety of C++ Code With a Quantities & Units Library
01h 02mA Physical Units Library For C++
01h 08mA Physical Units Library For the Next C++
01h 23mThe Power of C++ Templates With mp-units: Lessons Learned & a New Library Design
01h 31mImplementing Physical Units Library for C++
01h 40mUsing Units, Qantities, and Dimensions in C++14
55mTaking Static Type-safety to the Next Level: Physical Units for Matrices
01h 13mThe 10 Essential Features for the Future of C++ Libraries
