This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Squelch HOST_FLOAT_WORDS_BIG_ENDIAN


Richard Henderson <rth at redhat dot 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]