Re: cmath, math.h, and isnan
Re: cmath, math.h, and isnan
- Subject: Re: cmath, math.h, and isnan
- From: Tommy Nordgren <email@hidden>
- Date: Tue, 24 May 2005 12:05:17 +0200
May 24, 2005 kl. 1:08 AM skrev Bill Northcott:
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
It is better to define the inline fucntion(s) directly in terms of the
underlying api functions:
inline bool isNan(double x) {
return __isnand(x);
}
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
_______________________________________________
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