[haiku-development] Re: GCI task regarding <math.h>

  • From: Andreas Färber <andreas.faerber@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 21 Dec 2010 19:46:07 +0100

Am 20.12.2010 um 01:03 schrieb Ingo Weinhold:

On 2010-12-19 at 23:33:11 [+0100], scott mc <scottmc2@xxxxxxxxx> wrote:
Thanks for the reply.  Another thing relating to this, should we use:
#define isgreater(x, y) __builtin_isgreater ((x),(y))
#define isgreaterequal(x, y) __builtin_isgreaterequal ((x),(y))
#define isless(x, y) __builtin_isless ((x),(y))
#define islessequal(x, y) __builtin_islessequal ((x),(y))
#define islessgreater(x, y) __builtin_islessgreater ((x),(y))
#define isunordered(x, y) __builtin_isunordered ((x),(y))

or does Haiku not have these __builtin_ functions?  Are those
dependent on the CPU arch and/or gcc version?

__builtin_*() functions are provided by the compiler. The availability of built-in functions can be architecture dependent, though I doubt that this
is the case for the ones above. Generally gcc 2.95.3 has a lot less
built-ins than current versions, though it's possible certain built- ins have been deprecated or removed in the meantime. Check the gcc documentation
and/or test to be sure what works.

I've successfully used these as a local math.h patch for QEMU with gcc4, but I believe it's the wrong approach so I never proposed the patch. System headers should not depend on implementation details of the GCC compiler imo.

Regards,
Andreas

Other related posts: