Skip to content

Commit 67e72d1

Browse files
author
Colin Robertson
authored
Bulk fix: Remainder of keyword style fixes (#3011)
* C++ keyword style rationalization * Add some Microsoft-specific keywords * Update single-tick keywords * Add the bold keywords up to code_seg * Last set of keywords
1 parent c2c79b4 commit 67e72d1

File tree

1,732 files changed

+5418
-5396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,732 files changed

+5418
-5396
lines changed

docs/assembler/inline/accessing-c-or-cpp-data-in-asm-blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ ms.assetid: e99f5a28-0381-4090-8ece-6af8f2436a49
88

99
**Microsoft Specific**
1010

11-
A great convenience of inline assembly is the ability to refer to C or C++ variables by name. An `__asm` block can refer to any symbols, including variable names, that are in scope where the block appears. For instance, if the C variable `var` is in scope, the instruction
11+
A great convenience of inline assembly is the ability to refer to C or C++ variables by name. An **`__asm`** block can refer to any symbols, including variable names, that are in scope where the block appears. For instance, if the C variable `var` is in scope, the instruction
1212

1313
```cpp
1414
__asm mov eax, var
1515
```
1616

1717
stores the value of `var` in EAX.
1818

19-
If a class, structure, or union member has a unique name, an `__asm` block can refer to it using only the member name, without specifying the variable or `typedef` name before the period (**.**) operator. If the member name is not unique, however, you must place a variable or `typedef` name immediately before the period operator. For example, the structure types in the following sample share `same_name` as their member name:.
19+
If a class, structure, or union member has a unique name, an **`__asm`** block can refer to it using only the member name, without specifying the variable or **`typedef`** name before the period (**.**) operator. If the member name is not unique, however, you must place a variable or **`typedef`** name immediately before the period operator. For example, the structure types in the following sample share `same_name` as their member name:.
2020

2121
If you declare variables with the types
2222

docs/assembler/inline/asm.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ f1_keywords: ["__asm", "_asm", "__asm_cpp"]
55
helpviewer_keywords: ["__asm keyword [C++], vs. asm blocks", "__asm keyword [C++]"]
66
ms.assetid: 77ff3bc9-a492-4b5e-85e1-fa4e414e79cd
77
---
8-
# __asm
8+
# `__asm`
99

1010
**Microsoft Specific**
1111

12-
The `__asm` keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "`__asm` block" here refers to any instruction or group of instructions, whether or not in braces.
12+
The **`__asm`** keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "**`__asm`** block" here refers to any instruction or group of instructions, whether or not in braces.
1313

1414
> [!NOTE]
15-
> Visual C++ support for the Standard C++ `asm` keyword is limited to the fact that the compiler will not generate an error on the keyword. However, an `asm` block will not generate any meaningful code. Use `__asm` instead of `asm`.
15+
> Visual C++ support for the Standard C++ **`asm`** keyword is limited to the fact that the compiler will not generate an error on the keyword. However, an **`asm`** block will not generate any meaningful code. Use **`__asm`** instead of **`asm`**.
1616
1717
## Grammar
1818

1919
*asm-block*:<br/>
20-
&nbsp;&nbsp;&nbsp;&nbsp;**__asm** *assembly-instruction* **;**<sub>opt</sub><br/>
21-
&nbsp;&nbsp;&nbsp;&nbsp;**__asm {** *assembly-instruction-list* **}** **;**<sub>opt</sub>
20+
&nbsp;&nbsp;&nbsp;&nbsp;**`__asm`** *assembly-instruction* **`;`**<sub>opt</sub><br/>
21+
&nbsp;&nbsp;&nbsp;&nbsp;**`__asm {`** *assembly-instruction-list* **`}`** **`;`**<sub>opt</sub>
2222

2323
*assembly-instruction-list*:<br/>
24-
&nbsp;&nbsp;&nbsp;&nbsp;*assembly-instruction* **;**<sub>opt</sub><br/>
25-
&nbsp;&nbsp;&nbsp;&nbsp;*assembly-instruction* **;** *assembly-instruction-list* **;**<sub>opt</sub>
24+
&nbsp;&nbsp;&nbsp;&nbsp;*assembly-instruction* **`;`**<sub>opt</sub><br/>
25+
&nbsp;&nbsp;&nbsp;&nbsp;*assembly-instruction* **`;`** *assembly-instruction-list* **`;`**<sub>opt</sub>
2626

2727
## Remarks
2828

29-
If used without braces, the `__asm` keyword means that the rest of the line is an assembly-language statement. If used with braces, it means that each line between the braces is an assembly-language statement. For compatibility with previous versions, `_asm` is a synonym for `__asm`.
29+
If used without braces, the **`__asm`** keyword means that the rest of the line is an assembly-language statement. If used with braces, it means that each line between the braces is an assembly-language statement. For compatibility with previous versions, **`_asm`** is a synonym for **`__asm`**.
3030

31-
Since the `__asm` keyword is a statement separator, you can put assembly instructions on the same line.
31+
Since the **`__asm`** keyword is a statement separator, you can put assembly instructions on the same line.
3232

3333
Before Visual Studio 2005, the instruction
3434

@@ -40,11 +40,11 @@ did not cause native code to be generated when compiled with **/clr**; the compi
4040

4141
`__asm int 3` now results in native code generation for the function. If you want a function to cause a break point in your code and if you want that function compiled to MSIL, use [__debugbreak](../../intrinsics/debugbreak.md).
4242

43-
For compatibility with previous versions, **_asm** is a synonym for **__asm** unless compiler option [/Za \(Disable language extensions)](../../build/reference/za-ze-disable-language-extensions.md) is specified.
43+
For compatibility with previous versions, **`_asm`** is a synonym for **`__asm`** unless compiler option [/Za \(Disable language extensions)](../../build/reference/za-ze-disable-language-extensions.md) is specified.
4444

4545
## Example
4646

47-
The following code fragment is a simple `__asm` block enclosed in braces:
47+
The following code fragment is a simple **`__asm`** block enclosed in braces:
4848

4949
```cpp
5050
__asm {
@@ -54,23 +54,23 @@ __asm {
5454
}
5555
```
5656

57-
Alternatively, you can put `__asm` in front of each assembly instruction:
57+
Alternatively, you can put **`__asm`** in front of each assembly instruction:
5858

5959
```cpp
6060
__asm mov al, 2
6161
__asm mov dx, 0xD007
6262
__asm out dx, al
6363
```
6464

65-
Because the `__asm` keyword is a statement separator, you can also put assembly instructions on the same line:
65+
Because the **`__asm`** keyword is a statement separator, you can also put assembly instructions on the same line:
6666

6767
```cpp
6868
__asm mov al, 2 __asm mov dx, 0xD007 __asm out dx, al
6969
```
7070

71-
All three examples generate the same code, but the first style (enclosing the `__asm` block in braces) has some advantages. The braces clearly separate assembly code from C or C++ code and avoid needless repetition of the `__asm` keyword. Braces can also prevent ambiguities. If you want to put a C or C++ statement on the same line as an `__asm` block, you must enclose the block in braces. Without the braces, the compiler cannot tell where assembly code stops and C or C++ statements begin. Finally, because the text in braces has the same format as ordinary MASM text, you can easily cut and paste text from existing MASM source files.
71+
All three examples generate the same code, but the first style (enclosing the **`__asm`** block in braces) has some advantages. The braces clearly separate assembly code from C or C++ code and avoid needless repetition of the **`__asm`** keyword. Braces can also prevent ambiguities. If you want to put a C or C++ statement on the same line as an **`__asm`** block, you must enclose the block in braces. Without the braces, the compiler cannot tell where assembly code stops and C or C++ statements begin. Finally, because the text in braces has the same format as ordinary MASM text, you can easily cut and paste text from existing MASM source files.
7272

73-
Unlike braces in C and C++, the braces enclosing an `__asm` block don't affect variable scope. You can also nest `__asm` blocks; nesting does not affect variable scope.
73+
Unlike braces in C and C++, the braces enclosing an **`__asm`** block don't affect variable scope. You can also nest **`__asm`** blocks; nesting does not affect variable scope.
7474

7575
**END Microsoft Specific**
7676

docs/assembler/inline/assembly-language-comments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ ms.assetid: 0dc10850-77f5-426e-9dab-185ea28e06e4
88

99
**Microsoft Specific**
1010

11-
Instructions in an `__asm` block can use assembly-language comments:
11+
Instructions in an **`__asm`** block can use assembly-language comments:
1212

1313
```cpp
1414
__asm mov ax, offset buff ; Load address of buff
1515
```
1616

17-
Because C macros expand into a single logical line, avoid using assembly-language comments in macros. (See [Defining __asm Blocks as C Macros](../../assembler/inline/defining-asm-blocks-as-c-macros.md).) An `__asm` block can also contain C-style comments; for more information, see [Using C or C++ in __asm Blocks](../../assembler/inline/using-c-or-cpp-in-asm-blocks.md).
17+
Because C macros expand into a single logical line, avoid using assembly-language comments in macros. (See [Defining __asm Blocks as C Macros](../../assembler/inline/defining-asm-blocks-as-c-macros.md).) An **`__asm`** block can also contain C-style comments; for more information, see [Using C or C++ in __asm Blocks](../../assembler/inline/using-c-or-cpp-in-asm-blocks.md).
1818

1919
**END Microsoft Specific**
2020

docs/assembler/inline/calling-c-functions-in-inline-assembly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: f8a8d568-d175-4e23-9b24-36ef60a4cab3
88

99
**Microsoft Specific**
1010

11-
An `__asm` block can call C functions, including C library routines. The following example calls the `printf` library routine:
11+
An **`__asm`** block can call C functions, including C library routines. The following example calls the `printf` library routine:
1212

1313
```cpp
1414
// InlineAssembler_Calling_C_Functions_in_Inline_Assembly.cpp

docs/assembler/inline/calling-cpp-functions-in-inline-assembly.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ ms.assetid: 1f0d1eb3-54cf-45d5-838d-958188616b38
88

99
**Microsoft Specific**
1010

11-
An `__asm` block can call only global C++ functions that are not overloaded. If you call an overloaded global C++ function or a C++ member function, the compiler issues an error.
11+
An **`__asm`** block can call only global C++ functions that are not overloaded. If you call an overloaded global C++ function or a C++ member function, the compiler issues an error.
1212

13-
You can also call any functions declared with **extern "C"** linkage. This allows an `__asm` block within a C++ program to call the C library functions, because all the standard header files declare the library functions to have **extern "C"** linkage.
13+
You can also call any functions declared with **extern "C"** linkage. This allows an **`__asm`** block within a C++ program to call the C library functions, because all the standard header files declare the library functions to have **extern "C"** linkage.
1414

1515
**END Microsoft Specific**
1616

docs/assembler/inline/data-directives-and-operators-in-inline-assembly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: fb7410c7-156a-4131-bcfc-211aa70533e3
88

99
**Microsoft Specific**
1010

11-
Although an `__asm` block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives **DB**, `DW`, **DD**, `DQ`, `DT`, and `DF`, or the operators `DUP` or **THIS**. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives `STRUC`, `RECORD`, **WIDTH**, or **MASK**.
11+
Although an **`__asm`** block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives **DB**, `DW`, **DD**, `DQ`, `DT`, and `DF`, or the operators `DUP` or **THIS**. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives `STRUC`, `RECORD`, **WIDTH**, or **MASK**.
1212

1313
**END Microsoft Specific**
1414

docs/assembler/inline/debugging-and-listings-for-inline-assembly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Programs containing inline assembly code can be debugged with a source-level deb
1212

1313
Within the debugger, you can set breakpoints on both C or C++ and assembly-language lines. If you enable mixed assembly and source mode, you can display both the source and disassembled form of the assembly code.
1414

15-
Note that putting multiple assembly instructions or source language statements on one line can hamper debugging. In source mode, you can use the debugger to set breakpoints on a single line but not on individual statements on the same line. The same principle applies to an `__asm` block defined as a C macro, which expands to a single logical line.
15+
Note that putting multiple assembly instructions or source language statements on one line can hamper debugging. In source mode, you can use the debugger to set breakpoints on a single line but not on individual statements on the same line. The same principle applies to an **`__asm`** block defined as a C macro, which expands to a single logical line.
1616

1717
If you create a mixed source and assembly listing with the [/FAs](../../build/reference/fa-fa-listing-file.md) compiler option, the listing contains both the source and assembly forms of each assembly-language line. Macros are not expanded in listings, but they are expanded during compilation.
1818

docs/assembler/inline/defining-asm-blocks-as-c-macros.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ms.assetid: 677ba11c-21c8-4609-bba7-cd47312243b0
1010

1111
C macros offer a convenient way to insert assembly code into your source code, but they demand extra care because a macro expands into a single logical line. To create trouble-free macros, follow these rules:
1212

13-
- Enclose the `__asm` block in braces.
13+
- Enclose the **`__asm`** block in braces.
1414

15-
- Put the `__asm` keyword in front of each assembly instruction.
15+
- Put the **`__asm`** keyword in front of each assembly instruction.
1616

1717
- Use old-style C comments ( `/* comment */`) instead of assembly-style comments ( `; comment`) or single-line C comments ( `// comment`).
1818

@@ -28,21 +28,21 @@ To illustrate, the following example defines a simple macro:
2828
}
2929
```
3030

31-
At first glance, the last three `__asm` keywords seem superfluous. They are needed, however, because the macro expands into a single line:
31+
At first glance, the last three **`__asm`** keywords seem superfluous. They are needed, however, because the macro expands into a single line:
3232

3333
```cpp
3434
__asm /* Port output */ { __asm mov al, 2 __asm mov dx, 0xD007 __asm out dx, al }
3535
```
3636
37-
The third and fourth `__asm` keywords are needed as statement separators. The only statement separators recognized in `__asm` blocks are the newline character and `__asm` keyword. Because a block defined as a macro is one logical line, you must separate each instruction with `__asm`.
37+
The third and fourth **`__asm`** keywords are needed as statement separators. The only statement separators recognized in **`__asm`** blocks are the newline character and **`__asm`** keyword. Because a block defined as a macro is one logical line, you must separate each instruction with **`__asm`**.
3838
39-
The braces are essential as well. If you omit them, the compiler can be confused by C or C++ statements on the same line to the right of the macro invocation. Without the closing brace, the compiler cannot tell where assembly code stops, and it sees C or C++ statements after the `__asm` block as assembly instructions.
39+
The braces are essential as well. If you omit them, the compiler can be confused by C or C++ statements on the same line to the right of the macro invocation. Without the closing brace, the compiler cannot tell where assembly code stops, and it sees C or C++ statements after the **`__asm`** block as assembly instructions.
4040
41-
Assembly-style comments that start with a semicolon (**;**) continue to the end of the line. This causes problems in macros because the compiler ignores everything after the comment, all the way to the end of the logical line. The same is true of single-line C or C++ comments ( `// comment`). To prevent errors, use old-style C comments ( `/* comment */`) in `__asm` blocks defined as macros.
41+
Assembly-style comments that start with a semicolon (**;**) continue to the end of the line. This causes problems in macros because the compiler ignores everything after the comment, all the way to the end of the logical line. The same is true of single-line C or C++ comments ( `// comment`). To prevent errors, use old-style C comments ( `/* comment */`) in **`__asm`** blocks defined as macros.
4242
43-
An `__asm` block written as a C macro can take arguments. Unlike an ordinary C macro, however, an `__asm` macro cannot return a value. So you cannot use such macros in C or C++ expressions.
43+
An **`__asm`** block written as a C macro can take arguments. Unlike an ordinary C macro, however, an **`__asm`** macro cannot return a value. So you cannot use such macros in C or C++ expressions.
4444
45-
Be careful not to invoke macros of this type indiscriminately. For instance, invoking an assembly-language macro in a function declared with the `__fastcall` convention may cause unexpected results. (See [Using and Preserving Registers in Inline Assembly](../../assembler/inline/using-and-preserving-registers-in-inline-assembly.md).)
45+
Be careful not to invoke macros of this type indiscriminately. For instance, invoking an assembly-language macro in a function declared with the **`__fastcall`** convention may cause unexpected results. (See [Using and Preserving Registers in Inline Assembly](../../assembler/inline/using-and-preserving-registers-in-inline-assembly.md).)
4646
4747
**END Microsoft Specific**
4848

docs/assembler/inline/inline-assembler-overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The inline assembler lets you embed assembly-language instructions in your C and
1212

1313
Because the inline assembler doesn't require separate assembly and link steps, it is more convenient than a separate assembler. Inline assembly code can use any C or C++ variable or function name that is in scope, so it is easy to integrate it with your program's C and C++ code. And because the assembly code can be mixed with C and C++ statements, it can do tasks that are cumbersome or impossible in C or C++ alone.
1414

15-
The [__asm](../../assembler/inline/asm.md) keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "`__asm` block" here refers to any instruction or group of instructions, whether or not in braces.
15+
The [__asm](../../assembler/inline/asm.md) keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It cannot appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "**`__asm`** block" here refers to any instruction or group of instructions, whether or not in braces.
1616

17-
The following code is a simple `__asm` block enclosed in braces. (The code is a custom function prolog sequence.)
17+
The following code is a simple **`__asm`** block enclosed in braces. (The code is a custom function prolog sequence.)
1818

1919
```cpp
2020
// asm_overview.cpp
@@ -36,15 +36,15 @@ void __declspec(naked) main()
3636
}
3737
```
3838
39-
Alternatively, you can put `__asm` in front of each assembly instruction:
39+
Alternatively, you can put **`__asm`** in front of each assembly instruction:
4040
4141
```cpp
4242
__asm push ebp
4343
__asm mov ebp, esp
4444
__asm sub esp, __LOCAL_SIZE
4545
```
4646

47-
Since the `__asm` keyword is a statement separator, you can also put assembly instructions on the same line:
47+
Since the **`__asm`** keyword is a statement separator, you can also put assembly instructions on the same line:
4848

4949
```cpp
5050
__asm push ebp __asm mov ebp, esp __asm sub esp, __LOCAL_SIZE

0 commit comments

Comments
 (0)