![]() |
Blitz Support : |
From: Derrick Bass (derrick_at_[hidden])
Date: 2005-05-17 22:46:59
Hmmm.... I recall having this problem a while back. I investigated for
a bit and got very confused. It seems that some headers were defining
isnan to be a macro but then other headers would undefine the macro and
redefine it as a function. So the configure script would learn
something different from the actual code. I ended up with a using
declaration, which works in both cases:
In funcs.h I had
struct Fn_isnan {
typedef int T_numtype;
static inline T_numtype
apply(T_numtype1 a)
{
#ifdef isnan
// Some platforms define isnan as a macro, which causes the
// BZ_IEEEMATHFN_SCOPE macro to break.
return isnan(a);
#else
using namespace std;
return isnan(a);
#endif
}
....
and something similar in mathfunc.h. This fixes Mac OS X, but might
break other platforms. I think we need a new macro so you can write
something like:
BZ_USING_IEEEMATHFN_NAMESPACE;
instead of using namespace std.
Of course, this all seems like a big hack. Someone needs to figure out
why the configure script and the actual program see different header
files, but I was not really able to trace through that craziness.
Derrick
On May 17, 2005, at 8:08 PM, Julian Cummings wrote:
> The problem here is that cpp is not detecting that isnan is actually a
> macro function, not a normal function prototype. The blitz code uses
>
> #ifdef isnan
>
> to attempt to detect this situation, but it doesn't work. Is there a
> cpp guru out there who knows the proper way to detect whether something
> is a cpp macro function or not? I've tried a few ideas, but no luck
> thus far. Any help would be appreciated.
>
> Thanks, Julian C.
>
>
> On Mon, 2005-05-16 at 22:42 -0700, Creon Levit wrote:
>> checked out the latest cvs sources, ran autoreconf, configure, then
>> make
>> lib.
>>
>> ../blitz/mathfunc.h: In static member function `static int
>> blitz::_bz_blitz_isnan<P_numtype1>::apply(P_numtype1)':
>> ../blitz/mathfunc.h:1555: error: '::isnan' has not been declared
>> ../blitz/funcs.h: In static member function `static int
>> blitz::Fn_isnan<T_numtype1>::apply(T_numtype1)':
>> ../blitz/funcs.h:587: error: '::isnan' has not been declared
>> make[1]: *** [globals.lo] Error 1
>> make: *** [blitz-library] Error 1
>>
>> Now, gcc definitely has namespaces, and so I know it wasn't the
>> "right"
>> thing to do, but I got it to build and pass all tests by changing line
>> 138 of compiler.h from:
>>
>> #define BZ_IEEEMATHFN_SCOPE(x) ::x
>>
>> to:
>>
>> #define BZ_IEEEMATHFN_SCOPE(x) x
>>
>>
>>
>> _______________________________________________
>> Blitz-support mailing list
>> Blitz-support_at_[hidden]
>> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>>
> --
> Dr. Julian C. Cummings E-mail:
> cummings_at_[hidden]
> California Institute of Technology Phone: 626-395-2543
> 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917
> Pasadena, CA 91125 Office: 125 Powell-Booth
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>