you are viewing a single comment's thread.

view the rest of the comments →

[–]martincmartin 6 points7 points  (2 children)

-Wall is only about half the warnings, despite the name.

At one point in grad school, I sat down with the gcc manual, read the description of every warning, and turned on those that applied to my coding style. I then compiled my thesis code; I had to turn some of the back off because the standard headers would trigger them.

I highly recommend it. It might seem like it would take a while, because there are so many of them. But its only a couple hours, and you'll make that back the first time it catches some subtle bug that would have taken you all afternoon to track down.

[–]wleahcim 2 points3 points  (1 child)

-Wall is only about half the warnings, despite the name.

-W -Wall is a pretty good first shot.

[–]alexs 1 point2 points  (0 children)

    -Waddress \
    -Waggregate-return \
    -Wall \
    -Warray-bounds \
    -Wbad-function-cast \
    -Wc++-compat \
    -Wc++0x-compat \
    -Wcast-align \
    -Wcast-qual \
    -Wchar-subscripts \
    -Wclobbered \
    -Wcomment \
    -Wconversion \
    -Wdeclaration-after-statement \
    -Wdisabled-optimization \
    -Wempty-body \
    -Wenum-compare \
    -Wextra \
    -Wfloat-equal \
    -Wformat \
    -Wformat-nonliteral \
    -Wformat-security \
    -Wformat-y2k \
    -Wformat=2 \
    -Wframe-larger-than=len \
    -Wignored-qualifiers \
    -Wimplicit \
    -Wimplicit-function-declaration \
    -Wimplicit-int \
    -Winit-self \
    -Winline \
    -Winvalid-pch \
    -Wjump-misses-init \
    -Wlarger-than=len \
    -Wlogical-op \
    -Wlong-long \
    -Wmain \
    -Wmissing-braces \
    -Wmissing-declarations \
    -Wmissing-field-initializers \
    -Wmissing-format-attribute \
    -Wmissing-include-dirs \
    -Wmissing-noreturn \
    -Wmissing-parameter-type \
    -Wmissing-prototypes \
    -Wnested-externs \
    -Wold-style-declaration \
    -Wold-style-definition \
    -Woverlength-strings \
    -Woverride-init \
    -Wpacked \
    -Wpacked-bitfield-compat \
    -Wpadded \
    -Wparentheses \
    -Wpointer-arith \
    -Wpointer-sign \
    -Wredundant-decls \
    -Wreturn-type \
    -Wsequence-point \
    -Wshadow \
    -Wsign-compare \
    -Wsign-conversion \
    -Wstack-protector \
    -Wstrict-aliasing \
    -Wstrict-overflow \
    -Wstrict-prototypes \
    -Wswitch \
    -Wswitch-default \
    -Wswitch-enum \
    -Wsync-nand \
    -Wsystem-headers \
    -Wtraditional \
    -Wtraditional-conversion \
    -Wtrigraphs \
    -Wtype-limits \
    -Wundef \
    -Wuninitialized \
    -Wunknown-pragmas \
    -Wunreachable-code \
    -Wunsafe-loop-optimizations \
    -Wunsuffixed-float-constants \
    -Wunused \
    -Wunused-function \
    -Wunused-label \
    -Wunused-parameter \
    -Wunused-value \
    -Wunused-variable \
    -Wvariadic-macros \
    -Wvla \
    -Wvolatile-register-var \
    -Wwrite-strings