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

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Tue, 20 May 2014 12:56:18 +0100
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?

David

On 20 May 2014, at 11:11, Shane Ambler <FreeBSD_at_ShaneWare.Biz> wrote:

> When including stdint.h in c++ we can #define __STDC_LIMIT_MACROS so
> that we get macros like INT32_MAX defined.
> 
> Also related is __STDC_CONSTANT_MACROS
> 
> I have recently found that the need for these has been removed within
> the c++11 standard.
> 
> This year old bug report was to update glibc to this end -
> https://sourceware.org/bugzilla/show_bug.cgi?id=15366
> 
> Also of note is that Apple removed the use of this macro from OSX with
> the release of 10.9 over a year ago
> http://www.opensource.apple.com/source/xnu/xnu-2422.1.72/EXTERNAL_HEADERS/stdint.h
> 
> I believe as we push to use llvm's libc++ and support for c++11 we
> should also make sure the rest of our sources are kept up to date as
> well.
> 
> Are there any other changes within c++11 or c++14 that we should be
> looking to update?
> 
> Shane
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Tue May 20 2014 - 09:56:28 UTC

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