Possible Duplicate:
Best compiler warning level for C/C++ compilers?
GCC has thousands of options to add more warnings; I was hoping that -Wall -Wextra -pedantic included all the useful ones, but just now I met -Woverloaded-virtual which seems really nice to me.
What other G++ parameters do you use or would you recommend?
Not quite the same category but I always compile with
-Werrorto flag warnings as errors. Very useful.To make this work with 3rd party headers, I include those headers via
-isysteminstead of-I… otherwise warnings in those headers will break the build.There’s also
-Weffc++which warns for specific issues outlined in Meyers’ Effective C++. However, I’ve found this too harsh. For example, it warns for base classes that don’t declare virtual destructors. In theory, this is very nice but I’m working on a template library that uses inheritance for code reuse (and policy classes) and obviously they don’t have (nor need) virtual destructors.