Home c++ How to get a new standard C++ 20?

How to get a new standard C++ 20?




I write on C++ in Visual Studio 2017, quite recently realized that I have a very old standard C++ 98, but how so? It seems to be writing in Visual Studio 2017, so where can C++ 17 or C++ 20? How do I go to a new standard without updating your IDE until 2019? You can tell about this in more detail.

# include & lt; iostream & gt;
  STD :: COUT & LT; & LT; __cplusplus;
  Return 0;

I collect this code and get this:

Answer 1, Authority 100%

In Visual Studio 2017, it is enough to specify the required standard in the command prompt (up to 17) – run Cl /? , and see, in particular,


/ std: & lt; C++ 14 | C++ 17 | C++ Latest & GT; Standard version C++
C++ 14 - ISO / IEC & NBSP; 14882: 2014 (default)
C++ 17 - ISO / IEC & NBSP; 14882: 2017
C++ Latest - the last draft standard (a set of features can be changed)

This key can be specified in the operating system itself in the Variable environment Cl , for example,

set cl = / std: C++ Latest

Appropriate settings are available in IDE. Menu Project – & gt; Properties- & gt; Configuration properties- & gt; C / C++ – & gt; Language – & gt; C++ language standard

As far as I remember, in the first releases of VC++ 2017, C++ 11 was used by default, but I can be mistaken. In the latest version, the default C++ 14 is used, but you can switch to C++ 17.

that before C++ 20 – I’m afraid, in VC++ 2017 – no way … Here You can get acquainted with the fact that from the standard and in which version of VC++ has been implemented.

Answer 2, Authority 100%

You are probably wrong with respect to the current version of the standard – this macro by default reports about the presence of 1997 version for the provision of compatibility

because lots of existing code appears to depend on the value of this
Macro Matching "199711L", The Compiler Does Not Change the Value of
The Macro Unless You Explicitly Opt-in By Using The / ZC: _

And to check the version using this macro, you need to enable the compiler option / ZC

When the / zc: __ cplusplus option is Enabled, The Value Reported by The
__CplusPlus Macro Depends on the / Std Version Switch Setting.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions