Manfred Antar <[email protected]> writes:

> /usr/ports/astro/xtide doesn't complie on amd64 or i386 current for me
> It uses /usr/local/bin/gcc48 for compiler.
> System is current.
> The error is :
>
> xxGlobal.cc: In function 'void Global::PositioningSystem(Coordinates&)':
> xxGlobal.cc:80:24: error: 'isnan' was not declared in this scope
>          if (!(isnan(lat) || isnan(lng))) {
>                         ^
> xxGlobal.cc:80:24: note: suggested alternative:
> In file included from /usr/local/lib/gcc48/include/c++/random:38:0,
>                  from /usr/local/lib/gcc48/include/c++/bits/stl_algo.h:65,
>                  from /usr/local/lib/gcc48/include/c++/algorithm:62,
>                  from common.hh:135,
>                  from xtide.hh:21,
>                  from xxGlobal.cc:21:
> /usr/local/lib/gcc48/include/c++/cmath:632:5: note:   'std::isnan'
>      isnan(_Tp __x)
>      ^
[...]
> If  you:
> vi ./work/xtide-2.13.2/xxGlobal.cc
>
> and add to top of file:
> extern "C" int isnan (double);
>
> It will compile.

The compiler's suggestion may be better. C and POSIX currently disagree on
what type the parameter to isnan() should be, whereas in C++ std::isnan is
safe (because of overloading). This is C++ code anyway, so you can use its
version and not worry that it will break with some future change to math.h
or even of compiler-defined constants.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "[email protected]"

Reply via email to