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

Joe Buck jbuck@synopsys.com
Wed Sep 9 05:52:00 GMT 1998


> IMHO, it is needed now, and is even more likely to be needed in future.
> GCC provides more and more diagnostics and it becomes increasingly
> difficult to write code that compiles cleanly in reasonably strict
> compilation mode.
> 
> 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!

(This is why -Wall should only contain warnings that can be silenced
without making code worse).

> Personally, I hate it when I have to provide bogus initialisation for auto
> variables or provide unreachable return statements just because the
> compiler is not smart enough. I understand that it's unreasonable to
> expect it to be so smart, but still I hate being forced to cheat it.

In such cases, rather than turning off warnings, a mechanism like the
old lint /*NOTREACHED*/ would be preferable.






More information about the Gcc mailing list