简体   繁体   中英

Why is the Visual Studio Community 2017 C++ standard C++98?

Yesterday I upgraded to the latest VS Community 2017 (the previous one was installed last year) and wanted to check the C++ standard. So I run the following code that checks it, and as it turns out, I have C++98:

#include<iostream>
using namespace std;
int main()
{
    cout << __cplusplus << endl;
    system("pause");
}

Which outputs

199711

Why don't I have the latest C++ standard?

代码,输出和vs版本的屏幕截图

The value of __cplusplus is temporarily intentionally non-conformant by default for current versions of Visual Studio in order to avoid breaking existing code. It does not mean your compiler does not support any C++11 (or newer) features.

Quoting from MSVC now correctly reports __cplusplus :

/Zc:__cplusplus

You need to compile with the /Zc:__cplusplus switch to see the updated value of the __cplusplus macro. We tried updating the macro by default and discovered that a lot of code doesn't compile correctly when we change the value of __cplusplus . We'll continue to require use of the /Zc:__cplusplus switch for all minor versions of MSVC in the 19.xx family.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM