Quality for C++s
C++ quality is the set of practices that catch defects before release. It includes unit tests with frameworks such as GoogleTest or Catch2, sanitizers like AddressSanitizer and UBSan that detect memory and undefined behaviour errors, static analysis with clang-tidy, and warnings treated seriously. These checks matter because C++ allows many silent bugs.
Stage: Tooling · Part of the C++ roadmap · Last reviewed 19 November 2026
What to learn in Quality
- Write unit tests with GoogleTest or Catch2 and run them via CTest
- Enable AddressSanitizer to find leaks and out-of-bounds access
- Run clang-tidy and act on its modern C++ suggestions
- Turn on strict compiler warnings and fix them
- Profile a slow function before attempting to optimise it
Quality interview questions
What does AddressSanitizer detect?
AddressSanitizer instruments the program to catch memory errors at runtime, including heap and stack buffer overflows, use after free and, with leak detection, memory leaks. It slows execution, so it is used in testing builds rather than production.
Why is undefined behaviour a problem in C++?
The standard places no requirements on a program after undefined behaviour, so the compiler may assume it never happens and optimise accordingly. The result can be crashes, wrong output or apparent success that breaks on another compiler. Sanitizers help find it.
Where Quality fits in the C++ roadmap
Quality belongs to the Tooling stage (advanced level). Build and verify.