1
我正在使用Visual Studio 2015 Update 3,而我的_MSVC_LANG
被定义为201402L
,无论我是否提供/std:c++14
作为编译器参数。_MSVC_LANG有哪些值?
_MSVC_LANG
在晚期或早期版本的visual-C++中有其他值吗?
我正在使用Visual Studio 2015 Update 3,而我的_MSVC_LANG
被定义为201402L
,无论我是否提供/std:c++14
作为编译器参数。_MSVC_LANG有哪些值?
_MSVC_LANG
在晚期或早期版本的visual-C++中有其他值吗?
在Visual Studio 2015之前,_MSVC_LANG
宏不存在(在内部它们依赖于包含等效版本号的__cplusplus
宏)。
在Visual Studio的yvals.h
头,你可以看到C++版本的宏逻辑(这是从Visual Studio 2017年15.3.3):
#ifndef _HAS_CXX17
#if defined(_MSVC_LANG) && !(defined(__EDG__) && defined(__clang__)) // TRANSITION, VSO#273681
#if _MSVC_LANG > 201402
#define _HAS_CXX17 1
#else /* _MSVC_LANG > 201402 */
#define _HAS_CXX17 0
#endif /* _MSVC_LANG > 201402 */
#else /* _MSVC_LANG etc. */
#if __cplusplus > 201402
#define _HAS_CXX17 1
#else /* __cplusplus > 201402 */
#define _HAS_CXX17 0
#endif /* __cplusplus > 201402 */
#endif /* _MSVC_LANG etc. */
#endif /* _HAS_CXX17 */
预处理器定义_HAS_CXX17
& _HAS_CXX14
控制列入STL功能。
[This](https://blogs.msdn.microsoft.com/vcblog/2016/08/12/stl-fixes-in-vs-2015-update-3/)可能是你在找什么。 – selbie
/std:C++ 14是更新3的默认值,因此添加选项不会改变任何内容。没有早期版本的宏,我们没有时间机器来猜测更高版本。去尝试一下。 –