Libcxx marco using question

#if defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
in file
if this macro is really correct?
if __GNUC__ is 5 and __GNUC_MINOR__ is 2, it's seems this macro won't be passed.

So the marco should be
#if defined(__clang__) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) ||
(__GNUC__ >=5)

And also there is so much same macros define,
so we may using

#if defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)

then we using

do something
do something else

Attached an patch for it:)

type_traits.patch (8.39 KB)

Index: type_traits

This is a good suggestion, thanks. And thanks for the subsequent patches. I had been testing against g++-4.4 only in -std=c++0x mode. So I think I'll mix __GXX_EXPERIMENTAL_CXX0X__ into your good suggestion.


Nevermind about that __GXX_EXPERIMENTAL_CXX0X__ bit. The coffee is just now beginning to take effect... :wink:

Checked in.



#if defined(__GNUC__)
# if defined(__GNUC_PATCHLEVEL__)
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
                             + __GNUC_MINOR__ * 100 \
                             + __GNUC_PATCHLEVEL__)
# else
# define __GNUC_VERSION__ (__GNUC__ * 10000 \
                             + __GNUC_MINOR__ * 100)
# endif

which can then be used as follows:

#if defined(__clang__) || (__GNUC_VERSION__ >= 40300)

FWIW I'm personally for this sort of definition and use for versions :slight_smile:


<nod> I adopted a similar versioning scheme for libc++ for the same reasons. :wink:

#define _LIBCPP_VERSION 1000

There's room for 1000 minor versions, and major versions come in multiples of 1000. Kudo's go to Nick Kledzik for this.