Skip to content

Commit a18b248

Browse files
TylerMSFTTylerMSFT
authored andcommitted
tech review and cleanup
1 parent 5d1a391 commit a18b248

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

docs/c-language/c-keywords.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "C Keywords"
33
description: "Keywords in Standard C and Microsoft C compiler extensions."
4-
ms.date: 12/8/2020
4+
ms.date: "12/8/2020"
55
helpviewer_keywords: ["keywords [C]", "redefining keywords", "Microsoft-specific keywords"]
66
---
77
# C Keywords

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

Lines changed: 1 addition & 1 deletion
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, and in C11, a [Generic selection](generic_selection.md). An expression in parentheses is also a primary expression.
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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ This documentation generally uses the forms of the type specifiers listed in the
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

3030
**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

3434
**END Microsoft specific**
3535

docs/c-language/generic_selection.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ ms.date: "12/8/2020"
55
helpviewer_keywords: ["_Generic keyword [C]"]
66
---
77

8-
# Generic Selection (C11)
8+
# Generic selection (C11)
99

1010
Use the **`_Generic`** keyword to write code that makes a compile-time decision based on the type of the argument.
1111

12-
**`_Generic`** selects an expression based on a type at compile time. It's similar to overloading in C++ where the type of the argument is used to select which function to call. In this case, the type of the argument selects which expression to evaluate.
12+
**`_Generic`** selects an expression based on a type at compile time. 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.
1313

14-
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 will find it and return `"integer"`.
14+
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 will find it and return `"integer"`.
1515

1616
## Syntax
1717

1818
*`generic-selection`*:\
19-
&nbsp;&nbsp;&nbsp;&nbsp;**`_Generic`** **(** *`assignment-expression`, `assoc-list`* **)**
19+
&nbsp;&nbsp;&nbsp;&nbsp;**`_Generic`** **(** *`assignment-expression`, `assoc-list`* **)**
2020

2121
*`assoc-list`*:\
2222
&nbsp;&nbsp;&nbsp;&nbsp;*`association`*\
@@ -40,7 +40,7 @@ Entries in the `assoc-list` that aren't chosen aren't evaluated.
4040

4141
## Example
4242

43-
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()`, but a call with a complex double is mapped to `ccos()`.
43+
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()`.
4444

4545
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:
4646

@@ -51,8 +51,8 @@ The following example shows how to write a macro that identifies the type of the
5151

5252
/* Get a type name string for the argument x */
5353
#define TYPE_NAME(X) _Generic((X), \
54-
int: "int", \
55-
char: "char", \
54+
int: "int", \
55+
char: "char", \
5656
double: "double", \
5757
default: "unknown")
5858

@@ -63,7 +63,7 @@ int main()
6363
// The following would result in a compile error because
6464
// 42.4 is a double, doesn't match anything in the list,
6565
// and there is no default.
66-
// _Generic(42.4, int:"integer", char : "character"));
66+
// _Generic(42.4, int: "integer", char: "character"));
6767
}
6868

6969
/* Output:

0 commit comments

Comments
 (0)