Other than -Wall, what other warnings have people found useful?
Other than -Wall, what other warnings have people found useful?
I started out with C++, so when I made the switch to learning C I made sure to be extra-anal:
Right now I use:
-Wall -W -Wextra -Wconversion -Wshadow -Wcast-qual -Wwrite-strings -Werror
I took that list mostly from the book "An Introduction to GCC" (by rms) and then some from Ulrich Drepper's recommendation about defensive programming (slides for Defensive Programming).
But I don't have any science behind my list. It just felt like a good list.
Note: I don't like those pedantic flags though...
Note: I think that -W and -Wextra are more or less the same thing.