Hi, I noticed that boost/cstdint.h does not define int64_t when GCC is in strict mode (-ansi or -std=c++98) on MinGW, Cygwin, and probably other major platforms. This seems to be because boost/cstdint.h refuses to define the type if ULLONG_MAX (or ULONG_LONG_MAX or ULONGLONG_MAX) is not defined, even if BOOST_HAS_LONG_LONG is defined. GCC, quite correctly, will not define these macros in strict mode. However, the library still probably should be defining this type. Ideally, there would be a GCC-specific work-around to prevent warnings on the use of long long in strict mode. In particular, I am using the date_time library which depends on int64_t. It would be very unfortunate and a little silly if I could not use date_time in GCC's strict mode. How would it be best to fix this? Aaron
I noticed that boost/cstdint.h does not define int64_t when GCC is in strict mode (-ansi or -std=c++98) on MinGW, Cygwin, and probably other major platforms. This seems to be because boost/cstdint.h refuses to define the type if ULLONG_MAX (or ULONG_LONG_MAX or ULONGLONG_MAX) is not defined, even if BOOST_HAS_LONG_LONG is defined. GCC, quite correctly, will not define these macros in strict mode.
However, the library still probably should be defining this type. Ideally, there would be a GCC-specific work-around to prevent warnings on the use of long long in strict mode.
In particular, I am using the date_time library which depends on int64_t. It would be very unfortunate and a little silly if I could not use date_time in GCC's strict mode.
How would it be best to fix this?
This one is troublesome: boost/cstdint.hpp will just wrap stdint.h if that is available, and I'm pretty sure that won't define int64_t either when in strict mode. On second thoughts testing shows that cygwin (and linux as well I think) versions of stdint.h do define int64_t, but require the use of __extension__ to work correctly (without warnings or errors with -pedantic), I'm not sure how to handle this one, thoughts anyone? John.
How would it be best to fix this?
OK, in the end the fixes were trivial: The boost version of cstdint.hpp and it's test program now compiles in -pedantic -ansi mode with gcc (with int64_t support enabled). I've also enabled native stdint.h support for cygwin and mingw32, since these now supply this header. John.
participants (2)
-
Aaron W. LaFramboise
-
John Maddock