• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cmath, math.h, and isnan
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cmath, math.h, and isnan


  • Subject: Re: cmath, math.h, and isnan
  • From: Bill Northcott <email@hidden>
  • Date: Tue, 24 May 2005 09:08:26 +1000

Any chance someone knows how to do this outside of xcode?


gcc -D_GLIBCPP_USE_C99=1


I went round the traps on this one with R.

None of the fixes that are being suggested actually work.

The root problem is that on MacOS X/Darwin and a number of other systems, isnan() is a macro which translates to different function calls according to the type of the variable. Whereas on GNU/Linux where most open source software is developed, isnan() is a function.

Since cmath and any header that uses it, such as iostream, undefine isnan(), it is simply not possible to call isnan() from most C++ code.

The solution is to have a small C source that includes math.h and defines a function like myisnan() which itself just calls one of the isnan primitives such as isnand. This can then be called from C++ code.

Bill Northcott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: cmath, math.h, and isnan
      • From: Tommy Nordgren <email@hidden>
  • Prev by Date: Re: How to work around this bug?
  • Next by Date: Re: How to work around this bug?
  • Previous by thread: Re: cmath, math.h, and isnan
  • Next by thread: Re: cmath, math.h, and isnan
  • Index(es):
    • Date
    • Thread