Shipping C++ means strict warnings, sanitizers, static analysis, clear ownership, and reproducible builds—not just "it compiles on my machine."
Checklist
-Wall -Wextra -Werrorin CI- AddressSanitizer / UBSan in test builds
- clang-tidy and cppcheck for modern patterns
- Prefer smart pointers and STL over raw owning pointers
- Pin compiler versions; use CMake or Bazel with locked dependencies
- Fuzz parsers and network decoders where security matters
Important interview questions and answers
- Q: Why -Werror?
A: Treats warnings as failures—prevents merging latent undefined behavior and lifetime bugs. - Q: How reduce memory bugs?
A: RAII, smart pointers, sanitizers, code review, and avoiding raw ownership sprawl.
Self-check
- What sanitizer catches use-after-free?
- Why pin compiler versions in release builds?
Tip: Enable -Werror in CI only after fixing existing warnings—otherwise every branch blocks immediately.
Interview prep
- Why -Werror in CI?
Prevents merging code with warnings that often indicate real bugs—especially lifetime and type issues.
- Sanitizers in CI?
AddressSanitizer and UBSan catch memory errors during automated tests before production.