A quick check with CppCheck didn't show much besides scoping, but I'm not sure whether reduced scopes actually help speed. Maybe.Dann Corbit wrote:My recommendation is to use both GCC and CLANG with warnings turned up to crazy maximum and examine each and every one. (Expect thousands).
GCC under Linux offers tons of "sanitizer" options with checks during runtime. Slow of course, but good for spotting errors.
Coverity Scan is a nice option because it's free for Open Source projects; I'm also using it.
And btw., the makefile already has "-Wall -Wextra -Wshadow", so the warnings are already cranked up.
However, there is one thing where I'm not too sure. There is no clear compiler directive how to deal with pointer aliasing, and GCC changed that with 4.9 towards (ab)using it for optimisation. It's totally easy to get this in, and unless benchmarking shows a clear gain, I'd always use "-fno-strict-aliasing" for release, and while we're at it, also "-fno-strict-overflow".