You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/reference/std-specify-language-standard-version.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ The Microsoft C++ compiler in Visual Studio 2017 and later versions doesn't supp
27
27
28
28
## C++ standards support
29
29
30
-
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).
30
+
Detect whether the **`/std`** option is in effect during a C++ compilation with the [`_MSVC_LANG`](../../preprocessor/predefined-macros.md) preprocessor macro. For more information, see [Preprocessor Macros](../../preprocessor/predefined-macros.md).
31
31
32
32
> [!IMPORTANT]
33
33
> 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). Specify `/Zc:__cplusplus` and the **`/std`** option to set `__cplusplus` to the appropriate value.
@@ -38,7 +38,7 @@ Enables C++14 standard-specific features implemented by the MSVC compiler. This
38
38
39
39
This option disables compiler and standard library support for features that are changed or new in more recent versions of the language standard. However, it doesn't disable some C++17 features already implemented in previous releases of the MSVC compiler. For more information, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). The tables indicate which C++17 features are enabled when you specify **`/std:c++14`**.
40
40
41
-
The following features remain enabled when the **`/std:c++14`** option is specified to avoid breaking changes for users who have already taken dependencies on the features available in or before Visual Studio 2015 Update 2:
41
+
The following features remain enabled when the **`/std:c++14`** option is specified to avoid breaking changes for users who took dependencies on features available in or before Visual Studio 2015 Update 2:
42
42
43
43
-[Rules for `auto` with braced-init-lists](https://wg21.link/n3922)
44
44
-[`typename` in template template-parameters](https://wg21.link/n4051)
@@ -54,19 +54,19 @@ Depending on the MSVC compiler version or update level, C++17 features may not b
54
54
55
55
### `/std:c++20`
56
56
57
-
- Enables C++20 standard-specific features and behavior. Available starting in Visual Studio 2019 version 16.11, it enables the full set of C++20 features implemented by the MSVC compiler. Note that Visual Studio 2022 version 17.0 does not support `std::format`, the C++20 `<chrono>` formatting extensions, and the range factories and range adaptors from `<ranges>` under **`/std:c++20`** due to late-breaking changes in those features immediately after publication of the Standard.
58
-
- Enables the standard conformance mode provided by [**`/permissive-`**](./permissive-standards-conformance.md) unless explicitly overriden with **`/permissive`**.
59
-
- Disables compiler and standard library support for features that are new or changed after C++20. It specifically disables post-C++20 changes in the C++ Standard and versions of the Working Draft. It doesn't disable retroactive defect updates of the C++ Standard.
57
+
Enables C++20 standard-specific features and behavior. Available starting in Visual Studio 2019 version 16.11, it enables the full set of C++20 features implemented by the MSVC compiler. Visual Studio 2022 version 17.0 doesn't support `std::format`, the C++20 `<chrono>` formatting extensions, and the range factories and range adaptors from `<ranges>` under **`/std:c++20`** due to late-breaking changes in those features immediately after publication of the Standard.
58
+
59
+
Enables the standard conformance mode provided by [**`/permissive-`**](./permissive-standards-conformance.md) unless explicitly overridden with **`/permissive`**.
60
+
61
+
Disables compiler and standard library support for features that are new or changed after C++20. It specifically disables post-C++20 changes in the C++ Standard and versions of the Working Draft. It doesn't disable retroactive defect updates of the C++ Standard.
60
62
61
63
### `/std:c++23preview`
62
64
63
-
- Enables preview C++23 standard-specific features and behavior. Available starting in Visual Studio 2022 version 17.13. Preview features may change and may not be ABI compatible across releases.
64
-
- This switch will eventually be removed when the `/std:c++23` switch is implemented.
65
+
Enables preview C++23 standard-specific features and behavior. Available starting in Visual Studio 2022 version 17.13. Preview features may change and may not be ABI compatible across releases.
66
+
67
+
This switch will be removed when the `/std:c++23` switch is implemented--at which point all of the C++23 features will be implemented and ABI stable.
65
68
66
-
This switch differs from `/std:c++latest` in the following ways:
67
-
- Only features in the published [N4950 ISO C++23 final working draft](https://wg21.link/n4950) are enabled. No features in the latest [N5001 working draft (tenatively named C++26)](https://wg21.link/n5001) are enabled.
68
-
- This switch will be removed in a release following the completion of the C++23 features.
69
-
- ??? Note that Visual Studio 2022 version 17.0 does not support the C++23 `<chrono>` formatting extensions under **`/std:c++23preview`** due to late-breaking changes in those features immediately after publication of the Standard.
69
+
This switch differs from `/std:c++latest` in that it only enables features that are part of the C++23 standard. It does not enable experimental or in-progress features.
70
70
71
71
### `/std:c++latest`
72
72
@@ -76,22 +76,22 @@ Depending on the MSVC compiler version or update level, C++17, C++20, C++23, or
76
76
77
77
In versions of Visual Studio 2019 before version 16.11, **`/std:c++latest`** is required to enable all the compiler and standard library features of C++20.
78
78
79
-
Since Visual Studio 2019 version 16.8, the **`/std:c++latest`** option has enabled the standard conformance mode provided by [**`/permissive-`**](./permissive-standards-conformance.md) unless explicitly overriden with **`/permissive`**.
79
+
Since Visual Studio 2019 version 16.8, the **`/std:c++latest`** option has enabled the standard conformance mode provided by [**`/permissive-`**](./permissive-standards-conformance.md) unless explicitly overridden with **`/permissive`**.
80
80
81
81
For a list of supported language and library features, see [What's New for C++ in Visual Studio](../../overview/what-s-new-for-visual-cpp-in-visual-studio.md).
82
82
83
83
The **`/std:c++latest`** option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
84
84
85
85
> [!NOTE]
86
-
> The compiler and library features enabled by **`/std:c++latest`** may appear in a future C++ standard. Features that have not been approved are subject to breaking changes or removal without notice and are provided on an as-is basis.
86
+
> The compiler and library features enabled by **`/std:c++latest`** may appear in a future C++ standard. Features that haven't been approved are subject to breaking changes or removal without notice and are provided on an as-is basis.
87
87
88
88
## C standards support
89
89
90
90
You can invoke the Microsoft C compiler by using the [`/TC` or `/Tc`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. It's used by default for code that has a *`.c`* file extension, unless overridden by a **`/TP`** or **`/Tp`** option. The default C compiler (that is, the compiler when **`/std:c11`** or **`/std:c17`** isn't specified) implements ANSI C89, but includes several Microsoft extensions, some of which are part of ISO C99. Some Microsoft extensions to C89 can be disabled by using the [`/Za`](za-ze-disable-language-extensions.md) compiler option, but others remain in effect. It isn't possible to specify strict C89 conformance. The compiler doesn't implement several required features of C99, so it isn't possible to specify C99 conformance, either.
91
91
92
92
### `/std:c11`
93
93
94
-
-Enables ISO C11 conformance. It's available starting in Visual Studio 2019 version 16.8.
94
+
Enables ISO C11 conformance. It's available starting in Visual Studio 2019 version 16.8.
0 commit comments