Skip to content

Commit 3059e82

Browse files
authored
Update std-specify-language-standard-version.md
Add info about what to set __cplusplus to
1 parent 113ee82 commit 3059e82

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/build/reference/std-specify-language-standard-version.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ The Microsoft C++ compiler in Visual Studio 2017 and later versions doesn't supp
2828

2929
The **`/std`** option in effect during a C++ compilation can be detected by use of the [`_MSVC_LANG`](../../preprocessor/predefined-macros.md) preprocessor macro. For more information, see [Preprocessor Macros](../../preprocessor/predefined-macros.md).
3030

31-
The [`/Zc:__cplusplus`](zc-cplusplus.md) option must additionally be used for the `__cplusplus` macro to be correctly defined for the appropriate C++ standard.
31+
> [!IMPORTANT]
32+
> Because some existing code depends on the value of the macro `__cplusplus` being 199711L, the MSVC compiler doesn't change the value of this macro unless you explicitly opt in by setting [`/Zc:__cplusplus`](zc-cplusplus.md). Here are the values for `__cplusplus` depending on the language version you are compiling with:
33+
> | Language version | __cplusplus value |
34+
> | `/std:c++14` | 201402 |
35+
> | `/std:c++17` | 201703 |
36+
> | `/std:c++20` | 202002 |
3237
3338
**`/std:c++14`**\
3439
The **`/std:c++14`** option enables C++14 standard-specific features implemented by the MSVC compiler. This option is the default for code compiled as C++. It's available starting in Visual Studio 2015 Update 3.

0 commit comments

Comments
 (0)