Skip to content

Commit f7a3578

Browse files
authored
Merge branch 'master' into add-desc-08
2 parents b87f200 + 5a5897f commit f7a3578

13 files changed

+324
-135
lines changed

docs/atl-mfc-shared/reference/cstringt-class.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: "**`CStringT`** Class"
33
description: "API reference for the Microsoft ATL **`CStringT`** class"
4-
ms.date: "11/13/2020"
5-
f1_keywords: ["CStringT", "ATLSTR/ATL::CStringT", "ATLSTR/ATL::CStringT::CStringT", "ATLSTR/ATL::CStringT::AllocSysString", "ATLSTR/ATL::CStringT::AnsiToOem", "ATLSTR/ATL::CStringT::AppendFormat", "ATLSTR/ATL::CStringT::Collate", "ATLSTR/ATL::CStringT::CollateNoCase", "ATLSTR/ATL::CStringT::Compare", "ATLSTR/ATL::CStringT::CompareNoCase", "ATLSTR/ATL::CStringT::Delete", "ATLSTR/ATL::CStringT::Find", "ATLSTR/ATL::CStringT::FindOneOf", "ATLSTR/ATL::CStringT::Format", "ATLSTR/ATL::CStringT::FormatMessage", "ATLSTR/ATL::CStringT::FormatMessageV", "ATLSTR/ATL::CStringT::FormatV", "ATLSTR/ATL::CStringT::GetEnvironmentVariable", "ATLSTR/ATL::CStringT::Insert", "ATLSTR/ATL::CStringT::Left", "ATLSTR/ATL::CStringT::LoadString", "ATLSTR/ATL::CStringT::MakeLower", "ATLSTR/ATL::CStringT::MakeReverse", "ATLSTR/ATL::CStringT::MakeUpper", "ATLSTR/ATL::CStringT::Mid", "ATLSTR/ATL::CStringT::OemToAnsi", "ATLSTR/ATL::CStringT::Remove", "ATLSTR/ATL::CStringT::Replace", "ATLSTR/ATL::CStringT::ReverseFind", "ATLSTR/ATL::CStringT::Right", "ATLSTR/ATL::CStringT::SetSysString", "ATLSTR/ATL::CStringT::SpanExcluding", "ATLSTR/ATL::CStringT::SpanIncluding", "ATLSTR/ATL::CStringT::Tokenize", "ATLSTR/ATL::CStringT::Trim", "ATLSTR/ATL::CStringT::TrimLeft", "ATLSTR/ATL::CStringT::TrimRight", "CSTRINGT/CStringT", "CSTRINGT/CStringT::CStringT", "CSTRINGT/CStringT::AllocSysString", "CSTRINGT/CStringT::AnsiToOem", "CSTRINGT/CStringT::AppendFormat", "CSTRINGT/CStringT::Collate", "CSTRINGT/CStringT::CollateNoCase", "CSTRINGT/CStringT::Compare", "CSTRINGT/CStringT::CompareNoCase", "CSTRINGT/CStringT::Delete", "CSTRINGT/CStringT::Find", "CSTRINGT/CStringT::FindOneOf", "CSTRINGT/CStringT::Format", "CSTRINGT/CStringT::FormatMessage", "CSTRINGT/CStringT::FormatMessageV", "CSTRINGT/CStringT::FormatV", "CSTRINGT/CStringT::GetEnvironmentVariable", "CSTRINGT/CStringT::Insert", "CSTRINGT/CStringT::Left", "CSTRINGT/CStringT::LoadString", "CSTRINGT/CStringT::MakeLower", "CSTRINGT/CStringT::MakeReverse", "CSTRINGT/CStringT::MakeUpper", "CSTRINGT/CStringT::Mid", "CSTRINGT/CStringT::OemToAnsi", "CSTRINGT/CStringT::Remove", "CSTRINGT/CStringT::Replace", "CSTRINGT/CStringT::ReverseFind", "CSTRINGT/CStringT::Right", "CSTRINGT/CStringT::SetSysString", "CSTRINGT/CStringT::SpanExcluding", "CSTRINGT/CStringT::SpanIncluding", "CSTRINGT/CStringT::Tokenize", "CSTRINGT/CStringT::Trim", "CSTRINGT/CStringT::TrimLeft", "CSTRINGT/CStringT::TrimRight"]
4+
ms.date: 12/06/2020
5+
f1_keywords: ["CStringT", "CSTRINGT/ATL::CStringT", "CSTRINGT/ATL::CStringT::CStringT", "CSTRINGT/ATL::CStringT::AllocSysString", "CSTRINGT/ATL::CStringT::AnsiToOem", "CSTRINGT/ATL::CStringT::AppendFormat", "CSTRINGT/ATL::CStringT::Collate", "CSTRINGT/ATL::CStringT::CollateNoCase", "CSTRINGT/ATL::CStringT::Compare", "CSTRINGT/ATL::CStringT::CompareNoCase", "CSTRINGT/ATL::CStringT::Delete", "CSTRINGT/ATL::CStringT::Find", "CSTRINGT/ATL::CStringT::FindOneOf", "CSTRINGT/ATL::CStringT::Format", "CSTRINGT/ATL::CStringT::FormatMessage", "CSTRINGT/ATL::CStringT::FormatMessageV", "CSTRINGT/ATL::CStringT::FormatV", "CSTRINGT/ATL::CStringT::GetEnvironmentVariable", "CSTRINGT/ATL::CStringT::Insert", "CSTRINGT/ATL::CStringT::Left", "CSTRINGT/ATL::CStringT::LoadString", "CSTRINGT/ATL::CStringT::MakeLower", "CSTRINGT/ATL::CStringT::MakeReverse", "CSTRINGT/ATL::CStringT::MakeUpper", "CSTRINGT/ATL::CStringT::Mid", "CSTRINGT/ATL::CStringT::OemToAnsi", "CSTRINGT/ATL::CStringT::Remove", "CSTRINGT/ATL::CStringT::Replace", "CSTRINGT/ATL::CStringT::ReverseFind", "CSTRINGT/ATL::CStringT::Right", "CSTRINGT/ATL::CStringT::SetSysString", "CSTRINGT/ATL::CStringT::SpanExcluding", "CSTRINGT/ATL::CStringT::SpanIncluding", "CSTRINGT/ATL::CStringT::Tokenize", "CSTRINGT/ATL::CStringT::Trim", "CSTRINGT/ATL::CStringT::TrimLeft", "CSTRINGT/ATL::CStringT::TrimRight"]
66
helpviewer_keywords: ["strings [C++], in ATL", "shared classes, CStringT", "CStringT class"]
77
---
8-
# CStringT Class
8+
# `CStringT` Class
99

1010
This class represents a **`CStringT`** object.
1111

@@ -493,7 +493,7 @@ Because the constructors copy the input data into new allocated storage, memory
493493
- **`CStringT`**( `const unsigned char*` `psz` ): Allows you to construct a **`CStringT`** from a pointer to **`unsigned char`**.
494494

495495
> [!NOTE]
496-
> Define the` _CSTRING_DISABLE_NARROW_WIDE_CONVERSION` macro to turn off implicit string conversion between ANSI and Unicode strings. The macro excludes from compilation constructors that support conversion.
496+
> Define the `_CSTRING_DISABLE_NARROW_WIDE_CONVERSION` macro to turn off implicit string conversion between ANSI and Unicode strings. The macro excludes from compilation constructors that support conversion.
497497
498498
The *`strSrc`* parameter can be either a **`CStringT`** or `CThisSimpleString` object. For **`CStringT`**, use one of its default instantiations (`CString`, `CStringA`, or `CStringW`); for `CThisSimpleString`, use a **`this`** pointer. `CThisSimpleString` declares an instance of the [CSimpleStringT Class](../../atl-mfc-shared/reference/csimplestringt-class.md), which is a smaller string class with less built-in functionality than the **`CStringT`** class.
499499

@@ -1560,8 +1560,6 @@ Unlike the CRT tokenize functions like [`strtok_s, _strtok_s_l, wcstok_s, _wcsto
15601560

15611561
[!code-cpp[NVC_ATLMFC_Utilities#135](../../atl-mfc-shared/codesnippet/cpp/cstringt-class_39.cpp)]
15621562

1563-
### Remarks
1564-
15651563
The output from this example is as follows:
15661564

15671565
```Output
@@ -1606,8 +1604,6 @@ Removes all leading and trailing occurrences of one of the following:
16061604
16071605
[!code-cpp[NVC_ATLMFC_Utilities#136](../../atl-mfc-shared/codesnippet/cpp/cstringt-class_40.cpp)]
16081606
1609-
### Remarks
1610-
16111607
The output from this example is as follows:
16121608
16131609
```Output

docs/build/configure-cmake-debugging-sessions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Configure CMake debugging sessions in Visual Studio"
33
description: "Describes how to use Visual Studio to configure CMake debugger settings."
4-
ms.date: "04/02/2020"
4+
ms.date: "12/07/2020"
55
helpviewer_keywords: ["CMake debugging"]
66
---
77
# Configure CMake debugging sessions
@@ -105,6 +105,8 @@ In Visual Studio 2019 version 16.6, we added a new debug configuration of `type:
105105
#### Additional options allowed with the `gdbserver` configuration (16.7 or later)
106106

107107
- `program`: Defaults to `"${debugInfo.fullTargetPath}"`. The Unix path to the application to debug. Only required if different than the target executable in the build or deploy location.
108+
> [!TIP]
109+
> Deploy is not yet supported for local cross-compilation scenarios. If you are cross-compiling on Windows (for example, using a cross-compiler on Windows to build a Linux ARM executable) then you'll need to manually copy the binary to the location specified by `program` on the remote ARM machine before debugging.
108110
- `remoteMachineName`: Defaults to `"${debugInfo.remoteMachineName}"`. Name of the remote system that hosts the program to debug. Only required if different than the build system. Must have an existing entry in the [Connection Manager](../linux/connect-to-your-remote-linux-computer.md). Press **Ctrl+Space** to view a list of all existing remote connections.
109111
- `cwd`: Defaults to `"${debugInfo.defaultWorkingDirectory}"`. Full Unix path to the directory on the remote system where `program` is run. The directory must exist.
110112
- `gdbPath`: Defaults to `${debugInfo.vsInstalledGdb}`. Full Windows path to the `gdb` used to debug. Defaults to the `gdb` installed with the Linux development with C/C++ workload.

docs/build/vcpkg.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ The vcpkg package manager is updated regularly on GitHub. To update your clone o
221221

222222
To uninstall vcpkg, just delete the vcpkg directory. Deleting this directory uninstalls the vcpkg distribution, and all the libraries that vcpkg has installed.
223223

224+
However if you have executed **`vcpkg integrate install`** you should execute **`vcpkg integrate remove`** to ensure the integration is cleaned, before the folder is removed.
225+
224226
## Send feedback about vcpkg
225227

226228
Use the **`vcpkg contact --survey`** command to send feedback to Microsoft about vcpkg, including bug reports and suggestions for features.

docs/c-language/c-keywords.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
title: "C Keywords"
33
description: "Keywords in Standard C and Microsoft C compiler extensions."
4-
ms.date: 10/30/2020
4+
ms.date: "12/8/2020"
55
helpviewer_keywords: ["keywords [C]", "redefining keywords", "Microsoft-specific keywords"]
6-
ms.assetid: 2d932335-97bf-45cd-b367-4ae00db0ff42
76
---
87
# C Keywords
98

@@ -60,7 +59,7 @@ The C language uses the following keywords:
6059
**`_Atomic`** <sup>2, b</sup>\
6160
**`_Bool`** <sup>1, a</sup>\
6261
**`_Complex`** <sup>1, b</sup>\
63-
**`_Generic`** <sup>2, a</sup>\
62+
**[`_Generic`](generic_selection.md)** <sup>2, a</sup>\
6463
**`_Imaginary`** <sup>1, b</sup>\
6564
**`_Noreturn`** <sup>2, a</sup>\
6665
**`_Static_assert`** <sup>2, a</sup>\
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
---
2-
title: "C Primary Expressions"
3-
ms.date: "10/21/2018"
2+
title: "C primary expressions"
3+
description: "Explain what a C primary expression is"
4+
ms.date: "12/08/2020"
45
helpviewer_keywords: ["primary expressions"]
5-
ms.assetid: 49ac134f-0f8a-44f7-800e-86f31f2bd51c
66
---
7-
# C Primary Expressions
7+
# C primary expressions
88

9-
The operands in expressions are called "primary expressions."
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

13-
*primary-expression*:<br/>
14-
&nbsp;&nbsp;&nbsp;&nbsp;*identifier*<br/>
15-
&nbsp;&nbsp;&nbsp;&nbsp;*constant*<br/>
16-
&nbsp;&nbsp;&nbsp;&nbsp;*string-literal*<br/>
17-
&nbsp;&nbsp;&nbsp;&nbsp;**(** *expression* **)**
13+
*`primary-expression`*:\
14+
&nbsp;&nbsp;&nbsp;&nbsp;*`identifier`*\
15+
&nbsp;&nbsp;&nbsp;&nbsp;*`constant`*\
16+
&nbsp;&nbsp;&nbsp;&nbsp;*`string-literal`*\
17+
&nbsp;&nbsp;&nbsp;&nbsp;**(** *`expression`* **)**\
18+
&nbsp;&nbsp;&nbsp;&nbsp;*`generic-selection`*
1819

19-
*expression*:<br/>
20-
&nbsp;&nbsp;&nbsp;&nbsp;*assignment-expression*<br/>
21-
&nbsp;&nbsp;&nbsp;&nbsp;*expression* **,** *assignment-expression*
20+
*expression*:\
21+
&nbsp;&nbsp;&nbsp;&nbsp;*`assignment-expression`*\
22+
&nbsp;&nbsp;&nbsp;&nbsp;*`expression`***,** *`assignment-expression`*
2223

2324
## See also
2425

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

docs/c-language/data-type-specifiers-and-equivalents.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: "Data Type Specifiers and Equivalents"
2+
title: "Data type specifiers and equivalents"
3+
description: "Describes Microsoft Visual C data type specifiers and their equivalents."
34
ms.date: "11/04/2016"
45
helpviewer_keywords: ["type specifiers [C++], list", "widening integers", "data types [C++], equivalents", "sign-extending integral types", "zero-extending", "identifiers, data type", "data types [C++], specifiers", "simple types, names", "type names [C++], simple"]
5-
ms.assetid: 0d4b515a-4f68-4786-83cf-a5d43c7cb6f3
66
---
7-
# Data Type Specifiers and Equivalents
7+
# Data type specifiers and equivalents
88

9-
This book generally uses the forms of the type specifiers listed in the following table rather than the long forms, and it assumes that the **`char`** type is signed by default. Therefore, throughout this book, **`char`** is equivalent to **`signed char`**.
9+
This documentation generally uses the forms of the type specifiers listed in the following table rather than the long forms. It also assumes that the **`char`** type is signed by default. Throughout this documentation, **`char`** is equivalent to **`signed char`**.
1010

11-
## Type Specifiers and Equivalents
11+
## Type specifiers and equivalents
1212

1313
| Type Specifier | Equivalent(s) |
1414
|--|--|
@@ -23,15 +23,15 @@ This book generally uses the forms of the type specifiers listed in the followin
2323
| **`float`** ||
2424
| **`long double`**<sup>2</sup> ||
2525

26-
<sup>1</sup> When you make the **`char`** type unsigned by default (by specifying the **`/J`** compiler option), you cannot abbreviate **`signed char`** as **`char`**.
26+
<sup>1</sup> When you make the **`char`** type unsigned by default (by specifying the **`/J`** compiler option), you can't abbreviate **`signed char`** as **`char`**.
2727

2828
<sup>2</sup> In 32-bit and 64-bit operating systems, the Microsoft C compiler maps **`long double`** to type **`double`**.
2929

30-
**Microsoft Specific**
30+
**Microsoft specific**
3131

32-
You can specify the **`/J`** compiler option to change the default **`char`** type from **`signed char`** to **`unsigned char`**. When this option is in effect, **`char`** means the same as **`unsigned char`**, and you must use the **`signed`** keyword to declare a signed character value. If a **`char`** value is explicitly declared **`signed`**, the **`/J`** option does not affect it, and the value is sign-extended when widened to an **`int`** type. The **`char`** type is zero-extended when widened to **`int`** type.
32+
You can specify the **`/J`** compiler option to change the default **`char`** type from **`signed char`** to **`unsigned char`**. When this option is in effect, **`char`** means the same as **`unsigned char`**, and you must use the **`signed`** keyword to declare a signed character value. If a **`char`** value is explicitly declared **`signed`**, the **`/J`** option doesn't affect it, and the value is sign-extended when widened to an **`int`** type. The **`char`** type is zero-extended when widened to **`int`** type.
3333

34-
**END Microsoft Specific**
34+
**END Microsoft specific**
3535

3636
## See also
3737

docs/c-language/generic_selection.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "Generic selection (C11)"
3+
description: "Describes the C11 _Generic keyword used in the Microsoft Visual C compiler"
4+
ms.date: "12/9/2020"
5+
helpviewer_keywords: ["_Generic keyword [C]"]
6+
---
7+
8+
# Generic selection (C11)
9+
10+
Use the **`_Generic`** keyword to write code that selects an expression at compile time based on the type of the argument. It's similar to overloading in C++ where the type of the argument selects which function to call, except that the type of the argument selects which expression to evaluate.
11+
12+
For example, the expression `_Generic(42, int: "integer", char: "character", default: "unknown");` evaluates the type of `42` and looks for the matching type, `int`, in the list. It finds it and returns `"integer"`.
13+
14+
## Syntax
15+
16+
*`generic-selection`*:\
17+
&nbsp;&nbsp;&nbsp;&nbsp;**`_Generic`** **(** *`assignment-expression`, `assoc-list`* **)**
18+
19+
*`assoc-list`*:\
20+
&nbsp;&nbsp;&nbsp;&nbsp;*`association`*\
21+
&nbsp;&nbsp;&nbsp;&nbsp;*`assoc-list`, `association`*
22+
23+
*`association`*:\
24+
&nbsp;&nbsp;&nbsp;&nbsp;*`type-name`* : *`assignment-expression`*\
25+
&nbsp;&nbsp;&nbsp;&nbsp;**`default`** : *`assignment-expression`*
26+
27+
The first *`assignment-expression`* is called the controlling expression. The type of the controlling expression is determined at compile time and matched against the *`assoc-list`* to find which expression to evaluate and return. The controlling expression is not evaluated. For example, `_Generic(intFunc(), int: "integer", default: "error");` doesn't result in a call at runtime to `intFunc()`.
28+
29+
When the type of the controlling expression is determined, `const`, `volatile`, and `restrict` are removed before matching against *`assoc-list`*.
30+
31+
Entries in the `assoc-list` that aren't chosen aren't evaluated.
32+
33+
## Constraints
34+
35+
- The *`assoc-list`* can't specify the same type more than once.
36+
- The *`assoc-list`* can't specify types that are compatible with each other, such as an enumeration and the underlying type of that enumeration.
37+
- If a generic selection doesn't have a default, the controlling expression must have only one compatible type name in the generic association list.
38+
39+
## Example
40+
41+
One way to use **`_Generic`** is in a macro. The <tgmath.h> header file uses **_Generic** to call the right math function depending on the type of argument. For example, the macro for `cos()` maps a call with a float to `cosf()`, while mapping a call with a complex double to `ccos()`.
42+
43+
The following example shows how to write a macro that identifies the type of the argument you pass to it. It produces `"unknown"` if no entry in the *`assoc-list`* matches the controlling expression:
44+
45+
```C
46+
// Compile with /std:c11
47+
48+
#include <stdio.h>
49+
50+
/* Get a type name string for the argument x */
51+
#define TYPE_NAME(X) _Generic((X), \
52+
int: "int", \
53+
char: "char", \
54+
double: "double", \
55+
default: "unknown")
56+
57+
int main()
58+
{
59+
printf("Type name: %s\n", TYPE_NAME(42.42));
60+
61+
// The following would result in a compile error because
62+
// 42.4 is a double, doesn't match anything in the list,
63+
// and there is no default.
64+
// _Generic(42.4, int: "integer", char: "character"));
65+
}
66+
67+
/* Output:
68+
Type name: double
69+
*/
70+
71+
```
72+
73+
## See also
74+
75+
[`/std` (Specify Language Standard Version)](../build/reference/std-specify-language-standard-version.md)\
76+
[Type-generic math](../c-runtime-library/tgmath.md)

docs/c-language/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
href: ../c-language/string-literals-in-primary-expressions.md
271271
- name: Expressions in parentheses
272272
href: ../c-language/expressions-in-parentheses.md
273+
- name: Generic selection (C11)
274+
href: ../c-language/generic_selection.md
273275
- name: L-value and r-value expressions
274276
href: ../c-language/l-value-and-r-value-expressions.md
275277
- name: C constant expressions

0 commit comments

Comments
 (0)