问题
/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
...
回答1:
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
回答2:
No, the Microsoft compiler doesn't provide configurable compatibility. It is what it is.
来源:https://stackoverflow.com/questions/17753568/is-there-a-way-to-specify-c-compatibility-level-for-microsoft-c-compiler