Is there a way to specify C++ compatibility level

2019-08-21 08:04发布

/Tc compiler option resort only to C, but is there any way to specify the exact compatibility level for the Microsoft C++ compiler? Like C++11, C++03, C++98...

2条回答
Juvenile、少年°
2楼-- · 2019-08-21 08:17

As of Visual C++ 2015 Update 3, it is now possible to specify a language version for language behavior (apparently it doesn't affect just conformance checking):

https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/

Unfortunately the only options are "C++14" (not exact, it includes post-C++14 features which had previously shipped) and "C++ Latest" (C++14 plus partial implementation of C++17 and proposals, but not "experimental" features). There still are no options for enabling/disabling earlier versions of the language (C++98 / C++03 / C++11 as mentioned in the question)

The corresponding command line switches are:

  • /std:c++14
  • /std:c++latest
查看更多
做自己的国王
3楼-- · 2019-08-21 08:19

No, the Microsoft compiler doesn't provide configurable compatibility. It is what it is.

查看更多
登录 后发表回答