Problem building CVS version on OS X

Andrew Straw <strawman@...36...> writes:

extern "C" {
int isnan(double);
}

Apparently, the upshot is that isnan is a C99 feature and C++ does not
incorporate C99.

So, does that mean the above should work on most C++ compilers? (Do
they implement C99 mode when in extern "C" mode?)

What extern "C" does is it disables the C++ name-mangling so you can
refer to C functions. The presence of isnan is a header/library issue,
and apparently the cmath header file in some systems makes sure to
hide isnan. It seems that C99 defines an isnan _macro_, and the above
is assuming that an isnan _function_ exists in the library. The isnan
manual page on OS X states:

HISTORY
     3BSD introduced isinf() and isnan() functions, which accepted double
     arguments; these have been superseded by the macros described above.

I don't know how widespread these functions are. GNU libc and OS X
have them, and all the world's either Linux or a Mac, right? :slight_smile:

I think we could use the system's isnan macro in a fairly clean way by
performing the following dance (untested, and I don't have an OS X
10.3 system to test on):

#include <math.h>
template<typename T> int mpl_isnan(T arg) { return isnan(arg); }
#include <cmath>

Is it possible in distutils to do autoconf-style compilation tests at
configuration time?

ยทยทยท

--
Jouni