This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC warning options for numerical programs
On 04/23/2012 02:52 PM, Jeffrey Walton wrote:
> On Mon, Apr 23, 2012 at 9:45 AM, Andrew Haley <aph@redhat.com> wrote:
>> On 04/23/2012 02:37 PM, Jeffrey Walton wrote:
>>> If you don't want to know about potential problems, you don't have to
>>> use -Weverything (or -Wall -Wextra). Folks who are interested in all
>>> potential problems could use it (if available).
>>
>> I don't think so, given the variety of odd style warnings.
>>
>> I'm not even sure that the warnings are compatible with each other!
>> Anyone who just turns on *everything* is probably either doing so
>> because they're clueless because or a pointy-haired boss said "no
>> warnings."
> I fall into the later (but I'm not a boss). A clean compile is a security gate.
But a clean compile with no GCC warnings is not a security gate.
> When I start seeing problems with, for example, -Wconversion, I start
> questioning the lack of attention to detail and wonder if I'm dealing
> with a lazy or sloppy programmer or someone who has thought each
> warning through. I then write a negative test case and usually find
> its a sloppy programmer.
Yes. Some warnings are important, and some aren't. You have to be
discriminating or you mess up your program.
Consider, for instance, -Wdouble-promotion. If you're working on an
embedded system you might want this; if you're working on a desktop
system you probably don't. And do you want -Wtraditional ? I doubt
it.
Andrew.