[cfe-commits] r44058 - in /cfe/trunk: Sema/SemaExpr.cpp test/Sema/floating-point-compare.c

Neil Booth neil at daikokuya.co.uk
Wed Nov 14 03:36:34 PST 2007


Ted Kremenek wrote:-

> >More generally, should it be suppressed for comparisons against
> >any FP constant that is exact as written?
> >
> >Neil.
> 
> I'm not certain.  Also, I wonder if the following two cases should be  
> treated separately:
> 
>   x == 0.0
> 
> and
> 
>  x == 3.14159  (or any non-zero constant)
> 
> The first case still isn't really kosher either, but suppressing  
> warnings for explicit tests against 0.0 probably will suppress more  
> false positives than the number of false negatives it will cause.

Indeed, and same for 1.0 and -1.0 etc.  All those numbers are exact
as written.

> I think the second case is far more likely to be an error.

3.14159 is not exact as written so would be diagnosed under my
proposal.

Neil.



More information about the cfe-commits mailing list