C++ header file problem - is this a bug?

Bill Northcott w.northcott@unsw.edu.au
Tue Jan 4 07:13:00 GMT 2005


Problem C++ code:
#include <iostream>
#include <math.h>
isnan(x);

Preprocessing this on MacOS X 10.3.7 isnan(x) is unchanged, which is 
incorrect, because in math.h isnan() is a macro and should have been 
substituted.

If I comment out the first line the substitution becomes
isnan(x)   -->
( ( sizeof ( x ) == sizeof(double) ) ? __isnand ( x ) : ( sizeof ( x ) 
== sizeof( float) ) ? __isnanf ( x ) : __isnan ( x ) )
which is correct.

I have reproduced this with both gcc3.3 and gcc 4.0.

Is this a bug or is it expected behaviour and if so why?

Bill Northcott



More information about the Gcc mailing list