Skip to content

Commit 113ee82

Browse files
authored
Enhance /std documentation with reference to /Zc:__cplusplus
This change makes it much clearer as to what is required for C++ standards conformance when using the /std option - Specify Language Standard Version for C++. Motivation: The /std option implies standards conformance to C++ standards, yet it does not provide the most basic of conformance as it does not predefine the __cplusplus macro as mandated by the C++ standard (in section "Predefined macro names" - [cpp.predefined]). In order to conform to the standard, the /Zc:__cplusplus option is additionally required and this should be very clear in the documentation.
1 parent 743ae51 commit 113ee82

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ 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.
32+
3133
**`/std:c++14`**\
3234
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.
3335

@@ -123,5 +125,6 @@ For more information, see the C Standard library features section of [Microsoft
123125

124126
## See also
125127

128+
[`/Zc:__cplusplus[-]`](zc-cplusplus.md)<br/>
126129
[MSVC compiler options](compiler-options.md)<br/>
127130
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)

0 commit comments

Comments
 (0)