This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compile with gcc option -O0 or -O


David Brown <david@westcontrol.com> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]