Clang and GCC have a pretty solid suite of static checks that they can enforce if you enable them. They catch most of the common footguns.