not-a-number's
Tim Prince
n8tm@aol.com
Wed Jan 16 14:18:00 GMT 2013
On 1/16/2013 5:00 AM, Andrew Haley wrote:
> On 01/16/2013 11:54 AM, Mischa Baars wrote:
>>> Here's what Standard C, F.8.3 Relational operators, says:
>>>> x != x â false The statement x != x is true if x is a NaN.
>>>>
>>>> x == x â true The statement x == x is false if x is a NaN.
>> And indeed apparently the answer then is '2'. However, I don't think
>> this is correct. If that means that there is an error in the C
>> specification, then there probably is an error in the specification.
> Right. So we are agreed that GCC does what the specification of
> the C programming language says it must do. Any argument that you
> have must, therefore, be with the technical committee of ISO C, not
> with us.
>
> Andrew.
>
There exist compilers which have options to ignore the possibility of
NaN and replace x == x by 1 and x != x by 0 at compile time. gcc is
undoubtedly correct in not making such replacements as a default in
violation of C specification.
--
Tim Prince
More information about the Gcc
mailing list