-
Notifications
You must be signed in to change notification settings - Fork 176
Description
When trying to use the zfp library for a C++ project, we have encountered a warning regarding the use of the __STDC_VERSION__ macro at the very beginning of the zfp/types.h header file. The problem is that the g++ compiler does not define this macro, because it considers itself to be a C++ and not a C compiler, as pointed out in the documentation in https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html:
This macro is not defined if the -traditional-cpp option is used, nor when compiling C++ or Objective-C.
According to the C++ standards, it is perfectly legit for a C++ compiler to leave __STDC_VERSION__ undefined.
Therefore, you should at least check whether __STDC_VERSION__ is defined first. Also, you might consider preceding this by an #if block that checks for __cplusplus >= 201103L, which would indicate a C++11 conforming implementation that offers the cstdint header along with the necessary typedefs, which you could use in analogy to the C99-conforming case.
And furthermore, in lines 62 and 67 of zfp/types.h, you are using #elif ZFP_LP64 instead of #elif defined(ZFP_LP64), which also leads to at least one warning regarding undefined macros.