Warnings in the C++ Front-End and GCC in General

John Carr jfc@mit.edu
Wed Sep 9 18:07:00 GMT 1998

> > What if you worked for a company that required, as part of their coding
> > style, warningless compilation?
> But if we provide pragmas to turn off warnings and you use them, you
> are violating your company's coding style!

I worked for a company which "required" no warnings (there was some
flexibility, but the goal was no warnings).  I found selective warnings a
valuable feature.  The alternative to disabling specific warnings was not
useless code changes.  Generally not even "cheap" code changes like adding
redundant parentheses or unnecessary casts.  The alternative was to turn
off warnings.

I put in quite a bit of effort to analyze the warnings printed by 8
different compilers and decide what warning switches to use.  Usually I
turned on the maximum warning level and then turned off the specific
unwanted warnings.

I have even gone to the effort of modifying gcc to make it print warnings
the way I like them (for example, until the -Wno-parentheses switch was
added I disabled that warning in the gcc source code).

So count me in favor of better message control in gcc.

More information about the Gcc mailing list