Giles Robertson writes:
> 
> Can someone apply the following diff on
> simgear/sound/soundmgr_openal.cxx:
> 
> 45,47d44
> < #if defined(__MINGW32__)
> < #define isnan(x) _isnan(x)
> < #endif
> 63a61,63
> > #if defined(__MINGW32__)
> > #define isnan(x) _isnan(x)
> > #endif
> 
> This shifts the isnan definition after the other includes, so isnan
> isn't undefined, and allows SimGear to compile clean with MingW/MSYS.

Hmm... not so fast
This needs a __GNUC__ version check

to wit ...

<696> tmp
$ g++ --version
g++.exe (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


<697> tmp
$ g++ -o isnan isnan.cxx

<698> tmp
$ ./isnan
Bad Number = 1.#QNAN

and

<561> tmp
$ g++ -mno-cygwin -o isnan isnan.cxx

<562> tmp
$ ./isnan
Bad Number = 1.#QNAN

<563> tmp
$ g++ --version
g++ (GCC) 3.3.3 (cygwin special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

===== isnan.cxx =====

#include <math.h>
#include <iostream>

using namespace std;

#define my_make_dnan(x) (((unsigned int *) &x)[0] = 0xffffffff, ((unsigned int 
*) &x)[1] = 0x7fffffff)

void print_num( double x)
{
    if ( isnan(x) )
        cout << "Bad Number = " << x << endl;
    else
        cout << "Number = " << x << endl;
}

int main(int argc, char **argv)
{
    double bad_num;
    my_make_dnan(bad_num);
    print_num ( bad_num );
    return 0;
}



_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to