Re: updating standard headers to meet c++11 standard

From: Shane Ambler <FreeBSD_at_ShaneWare.Biz>
Date: Wed, 21 May 2014 15:40:25 +0930
On 20/05/2014 21:26, David Chisnall wrote:
> Hi,
> 
> I thought I'd already fixed this a year or so ago.  Looking at my system, I see this in cdefs.h:
> 
> /* C++11 exposes a load of C99 stuff */
> #if defined(__cplusplus) && __cplusplus >= 201103L
> #define __LONG_LONG_SUPPORTED
> #ifndef __STDC_LIMIT_MACROS
> #define __STDC_LIMIT_MACROS
> #endif
> #ifndef __STDC_CONSTANT_MACROS
> #define __STDC_CONSTANT_MACROS
> #endif
> #endif
> 
> So, if you're compiling C++ and the C++ standard is C++11 or later,
> we define the __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS macros. If
> it's C++98, you can define them yourself.
> 
> Do you have a test case where this doesn't work?
> 

I don't believe the standard used is specified so it must default to
C++98 leaving it manually defined. The changes made to glibc and osx
made these macros always defined without testing __STDC_LIMIT_MACROS
or __cplusplus

I guess we are technically correct but it also appears that we are the
odd one out. Which would depend on what you consider the default standard.


I have just been updating graphics/openimageio to 1.4.7

Larry is adding the following to fix compile on several targets
https://github.com/OpenImageIO/oiio/pull/858/files

This includes adding add_definitions ("-D__STDC_LIMIT_MACROS") to cover
the entire project. On FreeBSD I had issue when compiling
array_view_test.cpp which is fixed with the global addition.

The first change to src/include/OpenImageIO/image_view.h of adding
#define __STDC_LIMIT_MACROS before #include <stdint.h>  wasn't
sufficient to get the macros defined.

This will fall down to any project using image_view from oiio libs to
also define the standard or the macro.
Received on Wed May 21 2014 - 04:10:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:49 UTC