我正在使用 Visual Studio 2015 Update 3 并且 my_MSVC_LANG被定义为201402L,无论我是否/std:c++14作为编译器参数提供。
_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 */
Run Code Online (Sandbox Code Playgroud)
预处理器定义_HAS_CXX17和_HAS_CXX14控制 STL 功能的包含。
| 归档时间: |
|
| 查看次数: |
3218 次 |
| 最近记录: |