Other than -Wall what other warnings have people found useful?
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html
Other than -Wall what other warnings have people found useful?
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html
I started out with C++, so when I made the switch to learning C I made sure to be extra-anal:
I usually compile with "-W -Wall -ansi -pedantic" this helps ensure maximum quality and portability of the code.
-pedantic-errors
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" and then some from Ulrich Drepper recomendation about Defensive Programming (http://people.redhat.com/drepper/Defensive-slides.pdf).
But I don't have any science behind my list, it just felt like a good list.
/Johan
Note: I don't like those pedantic flags though....
Note: I think that -W and -Wextra are more or less the same thing.
-Wfatal-errors
I like -Werror. Keeps the code warning free.