[Swan] useless gcc "warning: comparison is always false due to limited range of data type [-Wtype-limits]"
Lennart Sorensen
lsorense at csclub.uwaterloo.ca
Wed Sep 25 00:56:59 EEST 2013
On Tue, Sep 24, 2013 at 02:56:41PM -0400, Paul Wouters wrote:
> On Tue, 24 Sep 2013, D. Hugh Redelmeier wrote:
>
> >I guess that the best approach is the flag -Wno-type-limits for this file.
> >Too bad you cannot do this for each problemetic expression.
>
> Can we add it via a #pragma within the file itself? If we add a flag, I
> fear we might lose it some time in the future.
Once you get into pragmas you start forcing one specific compiler to
be used.
Also I happen to think that gcc is right. The expression is useless
and hardly qualifies as defensive.
If a type can not have a value outside a certain range, then there is
nothing defensive about checking that it is in the only range it can
be in.
--
Len Sorensen
More information about the Swan
mailing list