Tips and Tricks for Improving C++ Legacy Codebases
summary
Merging three 20+ year C++ codebases uncovers ~2 million lines of code and drives pragmatic, incremental fixes: enable ASAN and UBSAN first on low-level libraries, build and pin your own clang-format/clang-tidy binaries, and use git hooks that format only changed lines. Catch API drift with clang-tidy diff and turn deprecations into CI failures. Share code via a DL boundary for complex legacy, header-only source for small ML outputs, copy/paste pure functions, or prebuilt static libs as a temporary bridge; TSAN gives noisy false positives.
AI-written summary · about
chapters (10)
- 0:00Introduction and background
- 3:06What is legacy code?
- 9:10Cautionary tale about changing legacy code
- 15:27Improving code with style guides
- 18:40Static analysis with sanitizers
- 25:49Changing legacy APIs
- 32:57Static analysis and deprecations
- 37:09Sharing code across teams
- 51:39Summary and incremental improvements
- 52:00Bonus: Refactoring legacy wrappers
