Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 2014 15:40:25 +0930
From:      Shane Ambler <FreeBSD@ShaneWare.Biz>
To:        David Chisnall <theraven@FreeBSD.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: updating standard headers to meet c++11 standard
Message-ID:  <537C4351.1020501@ShaneWare.Biz>
In-Reply-To: <26E76B72-1746-48A5-B6A2-335DEDF2026C@FreeBSD.org>
References:  <537B2A57.5080801@ShaneWare.Biz> <26E76B72-1746-48A5-B6A2-335DEDF2026C@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?537C4351.1020501>