Skip to content

Commit f95bf06

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#3254 from MicrosoftDocs/master637618812663222260
Repo sync for protected CLA branch
2 parents 8fba8df + b242a1e commit f95bf06

15 files changed

+161
-118
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,11 @@
805805
"redirect_url": "/cpp/build-insights/reference/wpa-views",
806806
"redirect_document_id": false
807807
},
808+
{
809+
"source_path": "docs/c-language/generic_selection.md",
810+
"redirect_url": "/cpp/c-language/generic-selection",
811+
"redirect_document_id": false
812+
},
808813
{
809814
"source_path": "docs/c-language/operators-c.md",
810815
"redirect_url": "/cpp/c-language/lexical-grammar",

docs/build/launch-vs-schema-reference-cpp.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
22
title: "launch.vs.json schema reference (C++)"
33
description: "Describes the schema elements for the `launch.vs.json` file"
4-
ms.date: "12/02/2020"
4+
ms.date: "7/12/2021"
55
helpviewer_keywords: ["launch.vs.json file [C++]"]
66
---
77
# launch.vs.json schema reference (C++)
88

9-
Use the *launch.vs.json* file to configure debugging parameters. To create the file. right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md).
9+
Starting in Visual Studio 2017, you can open code from nearly any type of directory-based project into Visual Studio without the need for a solution or project file. When there's no project or solution file, you can specify custom build tasks and launch parameters through JSON configuration files. This article describes the `launch.vs.json` file, which specifies debugging parameters. See [Develop code in Visual Studio without projects or solutions](https://docs.microsoft.com/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions) for more information about the "Open Folder" feature.
10+
11+
To create the file, right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md).
1012

1113
## Default properties
1214

@@ -56,6 +58,49 @@ Use the *launch.vs.json* file to configure debugging parameters. To create the f
5658
externalConsole|boolean|If true, a console is launched for the debuggee. If **`false`**, no console is launched. The default for this setting is **`false`**. This option is ignored in some cases for technical reasons.|
5759
|`pipeTransport`|string|When present, this tells the debugger to connect to a remote computer using another executable as a pipe that will relay standard input/output between Visual Studio and the MI-enabled debugger (such as gdb). Allowed values: one or more [Pipe Transport Options](#pipe_transport_options).|
5860

61+
## debugInfo macros
62+
63+
The following macros provide information about the debugging environment. They're useful for customizing the launch of your app for debugging.
64+
65+
|Macro |Description |Example |
66+
|---|---|---|
67+
| `addressSanitizerRuntimeFlags` | Runtime flags used to customize behavior of the address sanitizer. Used to set the environment variable `"ASAN_OPTIONS"`. | `"env": {"ASAN_OPTIONS": "${addressSanitizerRuntimeFlags}:anotherFlag=true"`} |
68+
| `defaultWorkingDirectory` | Set to the directory part of `"fullTargetPath"`. If the CMake variable `VS_DEBUGGER_WORKING_DIRECTORY` is defined, then `defaultWorkingDirectory` is set to that value, instead. | `"cwd":"${debugInfo.defaultWorkingDirectory}"` |
69+
| `fullTargetPath` | The full path to the binary being debugged. | `"program": "${debugInfo.fullTargetPath}"` |
70+
| `linuxNatvisPath` | The full windows path to the VS linux `.natvis` file. Usually appears as the value `"visualizerFile"`. |
71+
| `parentProcessId` | The process ID for the current Visual Studio instance. Used as a parameter to shellexec. | See pipeTransport example below. |
72+
| `remoteMachineId` | A unique, numeric identifier for the connection to the remote machine. Used as a parameter to shellexec. | See pipeTransport example below. |
73+
| `remoteWorkspaceRoot` | Linux path to the remote copy of the workspace. | Specify file locations on the remote machine. For example: `"args": ["${debugInfo.remoteWorkspaceRoot}/Data/MyInputFile.dat"]` |
74+
|`resolvedRemoteMachineName` | The name of the target remote machine. | `"targetMachine"` value in a deployment directive | |
75+
| `shellexecPath`| The path to the shellexec program that Visual Studio is using to manage the remote machine connection. | See pipeTransport example below |
76+
| `tty` | gdb will redirect input and output to this device for the program being debugged. Used as a parameter to gdb (-tty). | See pipeTransport example below. |
77+
| `windowsSubsystemPath` | The full path to the Windows Subsystem for Linux instance. | |
78+
79+
The pipeTransport example below shows how to use some of the `debugInfo` macros defined above:
80+
81+
```json
82+
"pipeTransport": {
83+
"pipeProgram": "${debugInfo.shellexecPath}",
84+
"pipeArgs": [
85+
"/s",
86+
"${debugInfo.remoteMachineId}",
87+
"/p",
88+
"${debugInfo.parentProcessId}",
89+
"/c",
90+
"${debuggerCommand}",
91+
"--tty=${debugInfo.tty}"
92+
],
93+
"pipeCmd": [
94+
"/s",
95+
"${debugInfo.remoteMachineId}",
96+
"/p",
97+
"${debugInfo.parentProcessId}",
98+
"/c",
99+
"${debuggerCommand}"
100+
]
101+
}
102+
```
103+
59104
## <a name="remote_deploy_debug"></a> C++ Windows remote debug and deploy properties
60105

61106
Used when debugging and deploying an app on a remote machine.

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

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ The **`/std`** options are available in Visual Studio 2017 and later. They're us
2222

2323
### C++ standards support
2424

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).
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).
2626

27-
**`/std:c++14`**
27+
**`/std:c++14`**\
28+
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.
2829

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.
30-
31-
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. For more information, see [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md). It indicates which C++14 and C++17 features are enabled when you specify **`/std:c++14`**.
30+
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`**.
3231

3332
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:
3433

@@ -38,69 +37,65 @@ The following features remain enabled when the **`/std:c++14`** option is specif
3837
- [Attributes for namespaces and enumerators](https://wg21.link/n4266)
3938
- [u8 character literals](https://wg21.link/n4267)
4039

41-
**`/std:c++17`**
42-
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
40+
**`/std:c++17`**\
41+
The **`/std:c++17`** option enables C++17 standard-specific features and behavior. It 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. It specifically disables post-C++17 changes in the C++ Standard and versions of the Working Draft. It does not disable retroactive defect updates of the C++ Standard. This option is available starting in Visual Studio 2017 version 15.3.
4442

4543
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/C++ language conformance](../../overview/visual-cpp-language-conformance.md).
4644

47-
**`/std:c++latest`**
48-
49-
Enable all currently implemented compiler and standard library features proposed for the next draft standard. Available starting with Visual Studio 2015 Update 3
45+
**`/std:c++latest`**\
46+
The **`/std:c++latest`** option enables all currently implemented compiler and standard library features proposed for the next draft standard, as well as some experimental features. This option is available starting in Visual Studio 2015 Update 3.
5047

51-
Enables the post-C++17 language and library features currently implemented in the compiler and libraries. These features may include changes to the latest Working Draft standard, defect updates, and experimental proposals for the standard.
48+
As of Visual Studio 2019 version 16.10, **`/std:c++latest`** is required to enable all the compiler and standard library features of C++20. There will be a **`/std:c++20`** option that does not include later proposed or experimental features in a future version of Visual Studio.
5249

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).
50+
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).
5451

55-
This option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
52+
The **`/std:c++latest`** option doesn't enable features guarded by the **`/experimental`** switch, but may be required to enable them.
5653

5754
> [!NOTE]
5855
> 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.
5956
6057
### C standards support
6158

62-
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.
63-
64-
**`/std:c11`**
65-
66-
Enable ISO C11 conformance. Available starting in Visual Studio 2019 version 16.8.
59+
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.
6760

68-
**`/std:c17`**
61+
**`/std:c11`**\
62+
The **`/std:c11`** option enables ISO C11 conformance. It's available starting in Visual Studio 2019 version 16.8.
6963

70-
Enable ISO C17 conformance. Available starting in Visual Studio 2019 version 16.8.
64+
**`/std:c17`**\
65+
The **`/std:c17`** option enables ISO C17 conformance. It's available starting in Visual Studio 2019 version 16.8.
7166

7267
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.
7368

7469
> [!NOTE]
75-
> At the time of release, the Windows SDK and UCRT libraries installed by Visual Studio don't support C11 and C17 code ywt. An updated 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).
70+
> At the time of release and through Visual Studio 2019 version 16.10, the Windows SDK and UCRT libraries installed by Visual Studio don't yet support C11 and C17 code. An updated 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).
7671
77-
When you specify **`/std:c11`** or **`/std:c17`**, MSVC supports all the features of C11 and C17 required by the standard. (Certain optional features aren't supported.) The compiler options enable support for these functionalities:
72+
When you specify **`/std:c11`** or **`/std:c17`**, MSVC supports all the features of C11 and C17 required by the standards. The **`/std:c11`** and **`/std:c17`** compiler options enable support for these functionalities:
7873

79-
- [`_Pragma`](../../preprocessor/pragma-directives-and-the-pragma-keyword.md#the-_pragma-preprocessing-operator-c99-c11)
74+
- [`_Pragma`](../../preprocessor/pragma-directives-and-the-pragma-keyword.md#the-pragma-preprocessing-operator)
8075

81-
- **`restrict`**
76+
- [`restrict`](../../c-language/type-qualifiers.md#restrict)
8277

83-
- **`_Noreturn`** and \<stdnoreturn.h>
78+
- [`_Noreturn`](../../c-language/noreturn.md) and \<stdnoreturn.h>
8479

85-
- **`_Alignas`**, **`_Alignof`** and \<stdalign.h>
80+
- [`_Alignas`, `_Alignof`](../../c-language/alignment-c.md) and \<stdalign.h>
8681

87-
- **`_Generic`** and \<tgmath.h>
82+
- [`_Generic`](../../c-language/generic-selection.md) and \<tgmath.h>
8883

89-
- **`_Static_assert`**
84+
- [`_Static_assert`](../../c-language/static-assert-c.md)
9085

91-
The IDE uses C settings for IntelliSense and code highlighting when your source files have a *`.c`* file extension, or when you specify the [`/TC`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. Currently, IntelliSense highlighting is only available for keywords, and not the macros introduced by the standard headers.
86+
The IDE uses C settings for IntelliSense and code highlighting when your source files have a *`.c`* file extension, or when you specify the [`/TC` or `/Tc`](tc-tp-tc-tp-specify-source-file-type.md) compiler option. Currently, IntelliSense in C highlights keywords `_Alignas`, `_Alignof`, `_Noreturn`, and `_Static_assert`, but not the equivalent macros defined in the standard headers: `alignas`, `alignof`, `noreturn`, and `static_assert`.
9287

93-
Since C17 is largely a bug fix release of ISO C11, MSVC support for C11 already includes all the relevant defect reports. There are no differences between the C11 and C17 versions except for the `__STDC_VERSION__` macro. It expands to `201112L` for C11, and `201710L` for C17.
88+
Since C17 is largely a bug-fix release of ISO C11, MSVC support for C11 already includes all the relevant defect reports. There are no differences between the C11 and C17 versions except for the `__STDC_VERSION__` macro. It expands to `201112L` for C11, and `201710L` for C17.
9489

9590
The compiler doesn't support most optional features of ISO C11. Several of these optional features of C11 were required features of C99 that MSVC hasn't implemented for architectural reasons. You can use the feature test macros such as `__STDC_NO_VLA__` to detect compiler support levels for individual features. For more information about C-specific predefined macros, see [Predefined macros](../../preprocessor/predefined-macros.md).
9691

97-
- There's no conforming multithreading, atomic, or complex number support in the Visual Studio 2019 version 16.8 release.
92+
- There's no conforming multithreading, atomic, or complex number support.
9893

9994
- `aligned_alloc` support is missing, because of the Windows heap implementation. The alternative is to use [`_aligned_malloc`](../../c-runtime-library/reference/aligned-malloc.md).
10095

101-
- DR 400 support is currently unimplemented for `realloc`, because this change would break the ABI.
96+
- [DR 400](http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400) support is currently unimplemented for `realloc`, because this change would break the ABI.
10297

103-
- Variable length array (VLA) support isn't planned. VLAs provide attack vectors comparable to `gets()`, which is deprecated and planned for removal.
98+
- Variable length array (VLA) support isn't planned. VLAs provide attack vectors comparable to [`gets`](../../c-runtime-library/gets-getws.md), which is deprecated and planned for removal.
10499

105100
For more information, see the C Standard library features section of [Microsoft C/C++ language conformance](../../overview/visual-cpp-language-conformance.md).
106101

docs/c-language/c-keywords.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The C language uses the following keywords:
5959
**`_Atomic`** <sup>2, b</sup>\
6060
**`_Bool`** <sup>1, a</sup>\
6161
**`_Complex`** <sup>1, b</sup>\
62-
**[`_Generic`](generic_selection.md)** <sup>2, a</sup>\
62+
**[`_Generic`](generic-selection.md)** <sup>2, a</sup>\
6363
**`_Imaginary`** <sup>1, b</sup>\
6464
**`_Noreturn`** <sup>2, a</sup>\
6565
**`_Static_assert`** <sup>2, a</sup>\

docs/c-language/c-primary-expressions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ helpviewer_keywords: ["primary expressions"]
66
---
77
# C primary expressions
88

9-
Primary expressions are the building blocks of more complex expressions. They may be constants, identifiers, a [Generic selection](generic_selection.md), or an expression in parentheses.
9+
Primary expressions are the building blocks of more complex expressions. They may be constants, identifiers, a [Generic selection](generic-selection.md), or an expression in parentheses.
1010

1111
## Syntax
1212

@@ -23,5 +23,5 @@ Primary expressions are the building blocks of more complex expressions. They ma
2323

2424
## See also
2525

26-
[Generic selection](generic_selection.md)
26+
[Generic selection](generic-selection.md)
2727
[Operands and Expressions](../c-language/operands-and-expressions.md)

0 commit comments

Comments
 (0)