This is the mail archive of the 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: [PATCH] Fold isnan to UNORDERED_EXPR

On Mon, 28 Jun 2004, Roger Sayle wrote:

> I think its best to define these builtins using DEF_C99_BUILTIN as regular
> functions, not just as a GCC extension called __builtin_isnan that uses
> varargs.  This follows the existing BSD 4.3 definitions of these
> functions, having an isnanf for floats, and an isnanl for long doubles.
> I'd like to think of C99's isgreater and friends as unusual exceptions
> where GCC has to use varargs to emulate a macro.  If ever we can avoid
> this idiom, we should.

While formally is* is a C90 reserved namespace, it's still the case that
as the compiler we don't tend to impinge on those namespaces other than
_[_A-Z].  As there are no such functions in C99, I think the best approach
is just to provide __builtin_isnan, which glibc can then use to provide
the isnan macro, just as it uses the other varargs built-in functions.  
Likewise __builtin_isfinite, __builtin_isinf, __builtin_isnormal,
__builtin_signbit, for consistency, if these are implemented as built-in
functions that it makes sense for GCC always to expand inline (this won't
work if some cases better expand to out-of-line calls to libm); this saves
messy macros in the headers.

Joseph S. Myers      (personal mail) (Bugzilla assignments and CCs)

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