Summary: | isnan() and isinf() should be std::isnan() and std::isinf() | ||
---|---|---|---|
Product: | [Applications] kcalc | Reporter: | Vadim Zhukov <persgray> |
Component: | general | Assignee: | Evan Teran <evan.teran> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | OpenBSD | ||
OS: | OpenBSD | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Patch to fix issue |
Description
Vadim Zhukov
2013-06-06 09:05:26 UTC
Created attachment 80337 [details]
Patch to fix issue
This bug is actually a little more interesting than it looks. isnan and isinf are actually *not* part of the c++03 standard! It is part of the c99 and c++11 standards. In c99 is specifically defined as a macro. In c++11 is described as being defined as both a macro and a function (the macro resolves to the function for C99 compatibility). So for a non c++11 library implementation, it shouldn't be in the std:: namespace at all. kcalc will define macros if cmake fails to find these two functions, the question is, why is cmake finding them if they are only available in the std:: namespace on your platform? I don't think that your patch is the "right" solution because there certainly exist some other standard libraries which have isnan/isinf but don't put them in std:: because if the library is a conforming c++03 implementation, it shouldn't! What version of OpenBSD are you running, I will set up a VM and investigate. General rule was always that all C stuff that's included from <c*> headers in C++ should be under std namespace. The KCalc compilation problems raised around 4.10.1, IIRC, some were fixed then and some were not. CMake finds those because doesn't distinguish C and C++ in check_function_exists(). I'm working on OpenBSD-CURRENT. If you'll need any help on setup, feel free to contact me directly. A fix has been posted to both Master and 4.11 branches. You should see it in the next release :-). Git commit 6f8c665a1ac91d636d219d8b2e8fce28b3f22ad7 by Raphael Kubo da Costa. Committed on 14/07/2013 at 22:07. Pushed by rkcosta into branch 'KDE/4.11'. Use math.h instead of cmath. Also known as "let's try to prevent the #ifdef madness before it grows too wild". `isinf' and `isnan' are macros in C99, are not mentioned in C++03 and are regular functions in C++11 (some C++ standard libraries such as GNU's libstdc++ do implement those functions in C++98 and C++03 mode). Simplify the current checks by unconditionally using math.h instead: this allows us not to care about whether the `std' namespace is required and assumes both `isinf' and `isnan' are macros, which are implemented when undefined. REVIEW: 111509 M +0 -3 CMakeLists.txt M +2 -6 knumber/knumber_float.cpp http://commits.kde.org/kcalc/6f8c665a1ac91d636d219d8b2e8fce28b3f22ad7 |