Build using multiple compilersSometimes you forget to #include something from a standard library that works on one compiler but doesn't on another or use constructs that don't compile on all compilers.
Static Analysis and high warning levelsI regularly run PVS-Studio, CppCheck and Clang static analyzers and use very high warning levels on my compilers.
My GCC warnings: -Wall -pedantic -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization \
-Wdouble-promotion -Wformat=2 -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs \
-Wshadow -Wredundant-decls -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wtrampolines \
-Wunsafe-loop-optimizations -Wvector-operation-performance -Wzero-as-null-pointer-constant