|
From: Bastian M. <bma...@we...> - 2016-02-14 09:46:34
|
Am 13.02.2016 um 21:23 schrieb sfeam:
(snip)
> In particular the change below is problematic because it was already tried in
> the main branch and turned out to cause problems on some systems:
>
> * src/qtterminal/qt_term.h src/qtterminal/qt_conversion.cpp: isnan()
> is in namespace std.
>
> See 5.1 ChangeLog:
>
> 2015-12-10 Hans-Bernhard Broeker <br...@ph...>
>
> * src/qtterminal/qt_conversion.cpp (qt_imageToQImage): Do not call
> C++ isnan() without a namespace specifier.
>
> EAM: Reverting this change. We may need a fix, but this isn't it.
> qtterminal/qt_conversion.cpp:
> In function 'QImage qt_imageToQImage(int, int, coordval*, t_imagecolor)':
> qtterminal/qt_conversion.cpp:129:14:
> error: expected unqualified-id before '(' token if (std::isnan(*image))
>
> I don't know what the issue is here, but since adding the std:: qualifier
> is known to break the build on some systems that were perfectly happy before
> this, I think it is not suitable for the stable branch.
>
OK. Reverted in branch-5-0-stable.
The problem is that isnan is in the C99 standard, but wasn't in the C++
standard until C++11. Hence, many C++ compilers implemented it "their"
way, as _isnan (MSVC), ::isnan, std::isnan or macro (as in C99). See
e.g. the discussion at
http://stackoverflow.com/questions/570669/checking-if-a-double-or-float-is-nan-in-c
Btw. simply adding a "using namespace std" doesn't solve the issue
either, since some compilers have both, ::isnan and std::isnan.
Too me it looks like the only way of solving this in a portable way is
to implement a C function like this in e.g. stdfn.c|h :
TBOOLEAN gp_isnan(double v)
{
return isnan(v);
}
Bastian
|