Skip to content

Commit 97f00bc

Browse files
TylerMSFTTylerMSFTTyler Whitney
authored
add operator / (#3568)
* add operator / * fix table, escape code * new class * add month_day class. Fix /std:latest to /std:20. Put chrono functions in alphabetical order * add new class: month-day-class. add some crosslinks * fix links * fixing links * add month-weekday class * add month-weekday-last-class * add missing method * fix links * links * cleanup * small fix * updates * trying to normalize on style * de-tablefied the compiler options * remove /std:c++20 * remove /std:C++20 * tech review * tech review/style updates * tech review and cleanup * fix links, keep d,y operators in chrono-literals * add metadata * cleanup * cleanup * normalize style * cleanup * escape code * update details on high resolution clock * acrolinx * cleanup * fix tables * fix table - bad escape * modify style for referring to signatures * tech review * cleanup * cleanup Co-authored-by: TylerMSFT <[email protected]> Co-authored-by: Tyler Whitney <[email protected]>
1 parent 1e53d58 commit 97f00bc

28 files changed

+1910
-986
lines changed

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

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
title: "/std (Specify Language Standard Version)"
33
description: "The MSVC compiler option /std specifies the C or C++ language standard supported by the compiler."
4-
ms.date: 10/29/2020
4+
ms.date: "5/21/2021"
55
f1_keywords: ["/std", "-std", "/std:c++14", "/std:c++17", "/std:c11", "/std:c17", "VC.Project.VCCLCompilerTool.CppLanguageStandard"]
6-
ms.assetid: 0acb74ba-1aa8-4c05-b96c-682988dc19bd
76
---
87
# `/std` (Specify Language Standard Version)
98

@@ -23,41 +22,53 @@ The **`/std`** option is available in Visual Studio 2017 and later. It's used to
2322

2423
### C++ standards support
2524

26-
By default, **`/std:c++14`** is specified, which disables language and standard library features found in later versions of the C++ language standard. Use **`/std:c++17`** to enable C++17 standard-specific features and behavior. To explicitly enable the currently implemented compiler and standard library features proposed for the next draft standard, use **`/std:c++latest`**. All C++20 features require **`/std:c++latest`**; when the implementation is complete, a new **`/std:c++20`** option will be enabled.
25+
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).
2726

28-
The default **`/std:c++14`** option enables the set of C++14 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are changed or new in more recent versions of the language standard. It doesn't disable some C++17 features already implemented in previous releases of the MSVC compiler. To avoid breaking changes for users who have already taken dependencies on the features available in or before Visual Studio 2015 Update 2, these features remain enabled when the **`/std:c++14`** option is specified:
27+
**`/std:c++14`**
2928

30-
- [Rules for `auto` with braced-init-lists](https://wg21.link/n3922)
29+
Enables C++14 standard-specific features implemented by the MSVC compiler. This option is the default for code compiled as C++. Available starting with Visual Studio 2015 Update 3. Enables C++14 standard-specific features implemented by the MSVC compiler.
3130

32-
- [`typename` in template template-parameters](https://wg21.link/n4051)
31+
This option disables compiler and standard library support for features that are changed or new in more recent versions of the language standard.<br>It doesn't disable some C++17 features already implemented in previous releases of the MSVC compiler. See [Microsoft C++ language conformance table](../../overview/visual-cpp-language-conformance.md) for a list of which C++14 and C++17 features are enabled when you specify **`/std:c++14`**.
3332

34-
- [Removing trigraphs](https://wg21.link/n4086)
33+
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:
3534

35+
- [Rules for `auto` with braced-init-lists](https://wg21.link/n3922)
36+
- [`typename` in template template-parameters](https://wg21.link/n4051)
37+
- [Removing trigraphs](https://wg21.link/n4086)
3638
- [Attributes for namespaces and enumerators](https://wg21.link/n4266)
37-
3839
- [u8 character literals](https://wg21.link/n4267)
3940

40-
A list of which C++14 and C++17 features are enabled when you specify **`/std:c++14`** is available. For more information, see the notes in [Microsoft C++ language conformance table](../../overview/visual-cpp-language-conformance.md).
41+
**`/std:c++17`**
4142

42-
The **`/std:c++17`** option enables the full set of C++17 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are new or changed after C++17. That includes post-C++17 changes in versions of the Working Draft and defect updates of the C++ Standard.
43+
Enable C++17 standard-specific features and behavior. Enables the full set of C++17 features implemented by the MSVC compiler. This option disables compiler and standard library support for features that are new or changed after C++17. That includes post-C++17 changes in versions of the Working Draft and defect updates of the C++ Standard. Available starting in Visual Studio version 15.3
4344

44-
The **`/std:c++latest`** option enables the post-C++17 language and library features currently implemented in the compiler and libraries. These features may include changes from the C++20 Working Draft, defect updates that aren't included in C++17, and experimental proposals for the draft standard. For a list of supported language and library features, see [What's New for Visual C++](../../overview/what-s-new-for-visual-cpp-in-visual-studio.md). The **`/std:c++latest`** option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
45+
Depending on the MSVC compiler version or update level, C++17 features may not be fully implemented or fully conforming when you specify the **`/std:c++17`** options. For an overview of C++ language conformance in Visual C++ by release version, see [Microsoft C++ language conformance table](../../overview/visual-cpp-language-conformance.md).
4546

46-
> [!IMPORTANT]
47-
> The compiler and library features enabled by **`/std:c++latest`** represent features that may appear in a future C++ standard, as well as C++20 features that are approved. Features that have not been approved are subject to breaking changes or removal without notice and are provided on an as-is basis.
47+
**`/std:c++latest`**
4848

49-
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).
49+
Enable all currently implemented compiler and standard library features proposed for the next draft standard. Available starting with Visual Studio 2015 Update 3
5050

51-
The **`/std:c++14`** and **`/std:c++latest`** options are available beginning in Visual Studio 2015 Update 3. The **`/std:c++17`** option is available beginning in Visual Studio 2017 version 15.3. As noted above, some C++17 standard behavior is enabled by the **`/std:c++14`** option, but all other C++17 features are enabled by **`/std:c++17`**. C++20 features are enabled by **`/std:c++latest`** until the implementation is complete.
51+
Enables the post-C++17 language and library features currently implemented in the compiler and libraries. These features may include changes from the C++20 Working Draft, defect updates that aren't included in C++17, and experimental proposals for the draft standard.
5252

53-
> [!NOTE]
54-
> Depending on the MSVC compiler version or update level, C++17 features may not be fully implemented or fully conforming when you specify the **`/std:c++17`** options. For an overview of C++ language conformance in Visual C++ by release version, see [Microsoft C++ language conformance table](../../overview/visual-cpp-language-conformance.md).
53+
For a list of supported language and library features, see [What's New for Visual C++](../../overview/what-s-new-for-visual-cpp-in-visual-studio.md).
5554

55+
This option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
56+
57+
> [!NOTE]
58+
> The compiler and library features enabled by **`/std:c++latest`** may appear in a future C++ standard, as well as approved C++20 features. Features that have not been approved are subject to breaking changes or removal without notice and are provided on an as-is basis.
5659
### C standards support
5760

5861
By default, when code is compiled as C, the MSVC compiler doesn't conform to a particular C standard. It implements ANSI C89 with several Microsoft extensions, some of which are part of ISO C99. Some Microsoft extensions 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.
5962

60-
Starting in Visual Studio 2019 version 16.8, you may specify **`/std:c11`** or **`/std:c17`** for code compiled as C. These options specify conformance modes that correspond with ISO C11 and ISO C17. Because the new preprocessor is needed to support these standards, the **`/std:c11`** and **`/std:c17`** compiler options set the [`/Zc:preprocessor`](zc-preprocessor.md) option automatically. If you want to use the traditional (legacy) preprocessor for C11 or C17, you must set the **`/Zc:preprocessor-`** compiler option explicitly. Setting the **`/Zc:preprocessor-`** option may lead to unexpected behavior, and isn't recommended.
63+
**`/std:c11`**
64+
65+
Enable ISO C11 conformance. Available starting in Visual Studio 2019 version 16.8.
66+
67+
**`/std:c17`**
68+
69+
Enable ISO C17 conformance. Available starting in Visual Studio 2019 version 16.8.
70+
71+
Because the new preprocessor is needed to support these standards, the **`/std:c11`** and **`/std:c17`** compiler options set the [`/Zc:preprocessor`](zc-preprocessor.md) option automatically. If you want to use the traditional (legacy) preprocessor for C11 or C17, you must set the **`/Zc:preprocessor-`** compiler option explicitly. Setting the **`/Zc:preprocessor-`** option may lead to unexpected behavior, and isn't recommended.
6172

6273
> [!NOTE]
6374
> At the time of release, the latest Windows SDK and UCRT libraries do not yet support C11 and C17 code. A pre-release version of the Windows SDK and UCRT is required. For more information and installation instructions, see [Install C11 and C17 support in Visual Studio](../../overview/install-c17-support.md).

0 commit comments

Comments
 (0)