comparison Core/Compatibility.h @ 3733:c1550e710410

Better C++11 detection for Visual C++
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 10 Mar 2020 10:34:09 +0100
parents 6cd4b7724c3d
children 89bd08fdd91b
comparison
equal deleted inserted replaced
3732:6cd4b7724c3d 3733:c1550e710410
45 // However, even in recent versions, __cplusplus will only be correct (that is, 45 // However, even in recent versions, __cplusplus will only be correct (that is,
46 // correctly defines the supported C++ version) if a special flag is passed to 46 // correctly defines the supported C++ version) if a special flag is passed to
47 // the compiler ("/Zc:__cplusplus") 47 // the compiler ("/Zc:__cplusplus")
48 // To make this header more robust, we use the _MSVC_LANG equivalent macro. 48 // To make this header more robust, we use the _MSVC_LANG equivalent macro.
49 49
50 # if _MSC_VER > 1900 50 // please note that not all C++11 features are supported when _MSC_VER == 1600
51 # if (defined _MSVC_LANG) && (_MSVC_LANG >= 201103L) 51 // (or higher). This header file can be made for fine-grained, if required,
52 # define ORTHANC_Cxx03_DETECTED 0 52 // based on specific _MSC_VER values
53 # else 53
54 # define ORTHANC_Cxx03_DETECTED 1 54 # if _MSC_VER >= 1600
55 # endif
56 # elif _MSC_VER > 1800
57 # define ORTHANC_Cxx03_DETECTED 0 55 # define ORTHANC_Cxx03_DETECTED 0
58 # else 56 # else
59 # define ORTHANC_Cxx03_DETECTED 1 57 # define ORTHANC_Cxx03_DETECTED 1
60 # endif 58 # endif
59
61 #else 60 #else
62 // of _MSC_VER is not defined, we assume __cplusplus is correctly defined 61 // of _MSC_VER is not defined, we assume __cplusplus is correctly defined
63 // if __cplusplus is not defined (very old compilers??), then the following 62 // if __cplusplus is not defined (very old compilers??), then the following
64 // test will compare 0 < 201103L and will be true --> safe. 63 // test will compare 0 < 201103L and will be true --> safe.
65 # if __cplusplus < 201103L 64 # if __cplusplus < 201103L