Re: compile with gcc option -O0 or -O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Brown <david@xxxxxxxxxxxxxxx> writes:
>> ... but be a bit wary of any warning option which isn't included in
>> -Wall or -Wextra -- they're usually omitted for a reason (typically
>> because they yield tons of false positives on reasonable code).
>
> That depends on your definition of "reasonable code" !

Of course.  :)

In general, though, there is some thought behind what's included in
-Wall/-Extra.  Stuff that's omitted tends to be where the warnings are
domain-specific, reflect programming practices which aren't widespread
enough, or where the gcc implementation is simply lacking in some
obvious way (sometimes it's very tricky to get the heuristics right).

-Wpadded, for instance, may be very interesting for embedded devs, but
probably not so much for many others, and yields vast quantities of
warnings on "ordinary" code.

-Wfloat-equal, on the other hand, reflects a rule of thumb which is very
useful when applied intelligently (i.e., by a human), but is less well
suited to automatic application.  [Testing for floating-point equality
is unreliable if the values being tested are the result of calculation,
but _is_ reliable if the values are the result of simple assignment,
especially certain values like 0.0 -- and the compiler is very unlikely
to be able to distinguish these cases.  If you _know_ that your
code-base never, ever, tests equality in the latter case, you can safely
use -Wfloat-equal, but this isn't something that can be relied upon.]

<etc etc blah blah>

-miles

-- 
values of β will give rise to dom!



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux