Is there a way to specify C++ compatibility level for Microsoft C++ compiler?

主宰稳场 提交于 2019-12-11 19:44:15

问题


/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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!