Safer C++ with MISRA-C++-2023
summary
MISRA‑C++:2023 targets C++17 and rewrites rules to be checkable by static analyzers while allowing justified deviations; it adds a rule forbidding range‑for initializers with more than one function call to avoid a temporary lifetime bug and highlights concrete UB cases like INT_MIN / -1 and the very high probability of signed multiplication overflow. Recommendations are pragmatic: turn on -Wall and treat warnings as errors, use sanitizers and unit tests, prefer strong/enum class types over raw ints, avoid bitfield/union tricks, and consider safe integer libraries (PSS safeints).
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:10Misra philosophy and safety
- 35:45Specific coding rules
- 40:05Undecidable rules and diagnostics
- 45:48Enumerations and types
- 48:49Type system importance
- 52:10Integer overflow dangers
- 56:46Safe integer libraries
- 1:02:13Strong typing and casting
- 1:09:28Class design guidelines
- 1:12:20Bitfield usage pitfalls
- 1:16:48Ref-qualified member functions
- 1:22:21Summary and best practices
related talks
01h 12mWriting robust code
01h 40mTesting, Preconditions, Coverage and Templates in Safety-Critical C++ Code
59mHardening Your Code
01h 04mThe Most Popular Bugs and Code Smells in C and C++
36mCode Analysis: Empowering developers to write performant, reliable, and safe C++
05mDetecting Programs That Rely on Undefined Behavior
26mUndefined Behavior in 2017 (part 2 of 2)
34mHidden in Plain Sight: Corner Case Defects
