Squelch HOST_FLOAT_WORDS_BIG_ENDIAN

Zack Weinberg zack@codesourcery.com
Thu Mar 13 20:41:00 GMT 2003


Richard Henderson <rth@redhat.com> writes:

> On Thu, Mar 13, 2003 at 10:55:30AM -0800, Zack Weinberg wrote:
>> float qnan = __builtin_nanf(0);
>
> 0 is not a valid argument.  "0" is.

Bleh.  real_nan() returns the result of get_canonical_[qs]nan if
passed a null pointer, and I mistakenly thought __builtin_nan would do
the same.

Changing it to "0" makes cc1 happy, but not cc1plus; I still get

test.cc:3: error: `double __builtin_nan(const char*)' cannot appear in a 
   constant-expression

from

class Double {
public:
  static const double NaN = __builtin_nan("0");
};

>>    0x1.0p+INF
>>    0x1.xxxxxxp+NAN (QNAN, SNAN)
>> 
>> which would require less fragile special-casing of builtin functions, etc.)
>
> Doesn't that run afoul of p-numbers etc?

No.  Arbitrary sequences of identifier-nondigits may appear at any
position in a pp-number except immediately before [+-] (where [eEpP]
is required).  See C99 6.4.8p1,2.

zw



More information about the Java mailing list