[xsd-users] [xsd/cxx/tree/serialization/{float, double}.hxx] warning: comparing floating point with == or != is unsafe

Boris Kolpackov boris at codesynthesis.com
Thu Sep 1 10:38:30 EDT 2011


Hi Eric,

Keller, Eric <eric.keller.ek1 at roche.com> writes:

> xsd/cxx/tree/serialization/float.hxx:35:37 
> xsd/cxx/tree/serialization/double.hxx:33:35:37:85
> 
> warning: comparing floating point with == or != is unsafe

These comparisons are there to detect special values (INF, NaN, etc)
which have to be serialized specially.


> unfortunately the gcc version we are using to compile, has some issue 
> with the #pragma GCC diagnostic push/ignored/pop so disabling these 
> warning is currently not possible...
>
> [...]
>
> Compiler version: gcc 4.4.3

#pragma GCC diagnostic is only supported in GCC 4.6 and up. Also, I
tried to reproduce this since we don't get these warnings in our
test builds. It seems that this warning has to explicitly requested
with the -Wfloat-equal option. -Wall doesn't turn it on, not even
-Wextra. I think that tell us that this warning is pretty useless
because of the noise it creates. So my suggestion would be to remove
the -Wfloat-equal option from your GCC command line.

Boris



More information about the xsd-users mailing list