~/talk

How to Improve the Safety of C++ Code With a Quantities & Units Library

Talkat CppCon 2024 · on Sunday, 2024-09-15· [c-and-cpp]
slides:none on file

A Modern C++ quantities library claims concrete safety: mp-units implements P2981 to make unit errors fail at compile time, catches truncation when converting integers, and encodes kinds so incompatible quantities (energy vs force) refuse to mix. Examples include a 31% historical miles error in Columbus’s data and references to mishaps like the Mars Climate Orbiter. Performance stays competitive with primitives — the generated code has same assembly as doubles — but MSVC required recent bug workarounds.

AI-written summary · about

  1. 0:00Introduction to CBP
  2. 0:31Physical units in software
  3. 1:53Impact of software bugs
  4. 5:08C++ safety challenges
  5. 7:01Library design goals
  6. 9:23Applications of units
  7. 10:16Issues in legacy code
  8. 11:53Inconsistent interfaces
  9. 13:52Library features
  10. 15:31Library capabilities
  11. 17:00Compiler support
  12. 19:30Standardization efforts
  13. 21:15Units library demo
  14. 22:18Safety through errors
  15. 24:13Stronger interface design
  16. 27:37Debugging library errors
  17. 28:33Performance comparisons
  18. 30:03Generic interfaces
  19. 30:53Practical use cases
  20. 33:13Affine space support
  21. 34:09Automatic conversions
  22. 34:49Unit definition limits
  23. 36:24Defining new units
  24. 37:49International units
  25. 39:15Preventing data loss
  26. 40:34Value preserving casts
  27. 42:54Columbus case study
  28. 44:21Historical unit analysis
  29. 46:56Calculating historical errors
  30. 49:32Library complexity
  31. 50:25Chrono comparison
  32. 51:17Safe numerical access
  33. 52:42Modeling complex domains
  34. 53:32Quantity specification
  35. 54:48Composability
  36. 55:53Compile-time validation
  37. 56:51Mathematical operations
  38. 58:20ISO 80000 compliance
  39. 59:31Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.