You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
13
+
The **`__asm`** keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It can't appear by itself. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at minimum, an empty pair of braces. The term "**`__asm`** block" here refers to any instruction or group of instructions, whether or not in braces.
14
14
15
15
> [!NOTE]
16
16
> 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`**.
@@ -37,7 +37,7 @@ Before Visual Studio 2005, the instruction
37
37
__asm int3
38
38
```
39
39
40
-
did not cause native code to be generated when compiled with **/clr**; the compiler translated the instruction to a CLR break instruction.
40
+
didn't cause native code to be generated when compiled with **/clr**; the compiler translated the instruction to a CLR break instruction.
41
41
42
42
`__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).
43
43
@@ -69,9 +69,9 @@ Because the **`__asm`** keyword is a statement separator, you can also put assem
69
69
__asm mov al, 2 __asm mov dx, 0xD007 __asm out dx, al
70
70
```
71
71
72
-
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.
72
+
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 can't 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.
73
73
74
-
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.
74
+
Unlike braces in C and C++, the braces enclosing an **`__asm`** block don't affect variable scope. You can also nest **`__asm`** blocks; nesting doesn't affect variable scope.
Because *constant-expression* is optional, the syntax has two forms:
31
+
Because *`constant-expression`* is optional, the syntax has two forms:
32
32
33
-
- The first form defines an array variable. The *constant-expression* argument within the brackets specifies the number of elements in the array. The *constant-expression*, if present, must have integral type, and a value larger than zero. Each element has the type given by *type-specifier*, which can be any type except **`void`**. An array element cannot be a function type.
33
+
- The first form defines an array variable. The *`constant-expression`* argument within the brackets specifies the number of elements in the array. The *`constant-expression`*, if present, must have integral type, and a value larger than zero. Each element has the type given by *`type-specifier`*, which can be any type except **`void`**. An array element can't be a function type.
34
34
35
-
- The second form declares a variable that has been defined elsewhere. It omits the *constant-expression* argument in brackets, but not the brackets. You can use this form only if you previously have initialized the array, declared it as a parameter, or declared it as a reference to an array explicitly defined elsewhere in the program.
35
+
- The second form declares a variable that has been defined elsewhere. It omits the *`constant-expression`* argument in brackets, but not the brackets. You can use this form only if you've previously initialized the array, declared it as a parameter, or declared it as a reference to an array that's explicitly defined elsewhere in the program.
36
36
37
-
In both forms, *direct-declarator* names the variable and can modify the variable's type. The brackets (**[]**) following *direct-declarator* modify the declarator to an array type.
37
+
In both forms, *`direct-declarator`* names the variable and can modify the variable's type. The brackets (**`[ ]`**) following *`direct-declarator`* modify the declarator to an array type.
38
38
39
39
Type qualifiers can appear in the declaration of an object of array type, but the qualifiers apply to the elements rather than the array itself.
40
40
41
41
You can declare an array of arrays (a "multidimensional" array) by following the array declarator with a list of bracketed constant expressions in this form:
Each *constant-expression* in brackets defines the number of elements in a given dimension: two-dimensional arrays have two bracketed expressions, three-dimensional arrays have three, and so on. You can omit the first constant expression if you have initialized the array, declared it as a parameter, or declared it as a reference to an array explicitly defined elsewhere in the program.
45
+
Each *`constant-expression`* in brackets defines the number of elements in a given dimension: two-dimensional arrays have two bracketed expressions, three-dimensional arrays have three, and so on. You can omit the first constant expression if you've initialized the array, declared it as a parameter, or declared it as a reference to an array explicitly defined elsewhere in the program.
46
46
47
47
You can define arrays of pointers to various types of objects by using complex declarators, as described in [Interpreting More Complex Declarators](../c-language/interpreting-more-complex-declarators.md).
48
48
@@ -52,7 +52,7 @@ Arrays are stored by row. For example, the following array consists of two rows
52
52
char A[2][3];
53
53
```
54
54
55
-
The three columns of the first row are stored first, followed by the three columns of the second row. This means that the last subscript varies most quickly.
55
+
The three columns of the first row are stored first, followed by the three columns of the second row. It means that the last subscript varies most quickly.
56
56
57
57
To refer to an individual element of an array, use a subscript expression, as described in [Postfix Operators](../c-language/postfix-operators.md).
58
58
@@ -72,7 +72,7 @@ struct {
72
72
} complex[100];
73
73
```
74
74
75
-
This is a declaration of an array of structures. This array has 100 elements; each element is a structure containing two members.
75
+
This example is a declaration of an array of structures. This array has 100 elements; each element is a structure containing two members.
76
76
77
77
```C
78
78
externchar *name[];
@@ -82,7 +82,7 @@ This statement declares the type and name of an array of pointers to **`char`**.
82
82
83
83
**Microsoft Specific**
84
84
85
-
The type of integer required to hold the maximum size of an array is the size of **size_t**. Defined in the header file STDDEF.H, **size_t** is an **`unsigned int`** with the range 0x00000000 to 0x7CFFFFFF.
85
+
The type of integer required to hold the maximum size of an array is the size of **`size_t`**.
Both operands must be integral values. These operators perform the usual arithmetic conversions; the type of the result is the type of the left operand after conversion.
20
20
21
-
For leftward shifts, the vacated right bits are set to 0. For rightward shifts, the vacated left bits are filled based on the type of the first operand after conversion. If the type is **`unsigned`**, they are set to 0. Otherwise, they are filled with copies of the sign bit. For left-shift operators without overflow, the statement
21
+
For leftward shifts, the vacated right bits are set to 0. For rightward shifts, the vacated left bits are filled based on the type of the first operand after conversion. If the type is **`unsigned`**, they're set to 0. Otherwise, they're filled with copies of the sign bit. For left-shift operators without overflow, the statement
22
22
23
23
```C
24
24
expr1 << expr2
@@ -34,7 +34,7 @@ is equivalent to division by 2<sup>expr2</sup> if `expr1` is unsigned or has a n
34
34
35
35
The result of a shift operation is undefined if the second operand is negative, or if the right operand is greater than or equal to the width in bits of the promoted left operand.
36
36
37
-
Since the conversions performed by the shift operators do not provide for overflow or underflow conditions, information may be lost if the result of a shift operation cannot be represented in the type of the first operand after conversion.
37
+
Since the conversions performed by the shift operators don't provide for overflow or underflow conditions, information may be lost if the result of a shift operation can't be represented in the type of the first operand after conversion.
Copy file name to clipboardExpand all lines: docs/c-language/break-statement-c.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ The **`break`** statement terminates the execution of the nearest enclosing **`d
12
12
13
13
## Syntax
14
14
15
-
*jump-statement*:<br/>
16
-
**break ;**
15
+
*`jump-statement`*:\
16
+
 **`break ;`**
17
17
18
18
The **`break`** statement is frequently used to terminate the processing of a particular case within a **`switch`** statement. Lack of an enclosing iterative or **`switch`** statement generates an error.
An abstract declarator is a declarator without an identifier, consisting of one or more pointer, array, or function modifiers. The pointer modifier (<strong>\*</strong>) always precedes the identifier in a declarator; array (**[]**) and function ( **( )** ) modifiers follow the identifier. Knowing this, you can determine where the identifier would appear in an abstract declarator and interpret the declarator accordingly. See [Interpreting More Complex Declarators](../c-language/interpreting-more-complex-declarators.md) for additional information and examples of complex declarators. Generally **`typedef`** can be used to simplify declarators. See [Typedef Declarations](../c-language/typedef-declarations.md).
10
+
An abstract declarator is a declarator without an identifier, consisting of one or more pointer, array, or function modifiers. The pointer modifier (**`*`**) always precedes the identifier in a declarator; array (**[]**) and function ( **( )** ) modifiers follow the identifier. Knowing this, you can determine where the identifier would appear in an abstract declarator and interpret the declarator accordingly. See [Interpreting More Complex Declarators](../c-language/interpreting-more-complex-declarators.md) for additional information and examples of complex declarators. Generally **`typedef`** can be used to simplify declarators. See [Typedef Declarations](../c-language/typedef-declarations.md).
11
11
12
12
Abstract declarators can be complex. Parentheses in a complex abstract declarator specify a particular interpretation, just as they do for the complex declarators in declarations.
> Although the syntax for *additive-expression* includes *multiplicative-expression*, this does not imply that expressions using multiplication are required. See the syntax in [C Language Syntax Summary](../c-language/c-language-syntax-summary.md), for *multiplicative-expression*, *cast-expression*, and *unary-expression*.
20
+
> Although the syntax for *`additive-expression`* includes *`multiplicative-expression`*, this does not imply that expressions using multiplication are required. See the syntax in [C Language Syntax Summary](../c-language/c-language-syntax-summary.md), for *`multiplicative-expression`*, *cast-expression*, and *unary-expression*.
21
21
22
22
The operands can be integral or floating values. Some additive operations can also be performed on pointer values, as outlined under the discussion of each operator.
23
23
24
-
The additive operators perform the usual arithmetic conversions on integral and floating operands. The type of the result is the type of the operands after conversion. Since the conversions performed by the additive operators do not provide for overflow or underflow conditions, information may be lost if the result of an additive operation cannot be represented in the type of the operands after conversion.
24
+
The additive operators perform the usual arithmetic conversions on integral and floating operands. The type of the result is the type of the operands after conversion. Since the conversions performed by the additive operators don't provide for overflow or underflow conditions, information may be lost if the result of an additive operation isn't representable in the type of the operands after conversion.
25
25
26
26
## See also
27
27
28
-
[Additive Operators: + and -](../cpp/additive-operators-plus-and.md)
28
+
[Additive Operators: `+` and `-`](../cpp/additive-operators-plus-and.md)
An assignment operation assigns the value of the right-hand operand to the storage location named by the left-hand operand. Therefore, the left-hand operand of an assignment operation must be a modifiable l-value. After the assignment, an assignment expression has the value of the left operand but is not an l-value.
10
+
An assignment operation assigns the value of the right-hand operand to the storage location named by the left-hand operand. Therefore, the left-hand operand of an assignment operation must be a modifiable l-value. After the assignment, an assignment expression has the value of the left operand but isn't an l-value.
The assignment operators in C can both transform and assign values in a single operation. C provides the following assignment operators:
22
22
23
-
|Operator|Operation Performed|
24
-
|--------------|-------------------------|
25
-
|**`=`**|Simple assignment|
26
-
|**`*=`**|Multiplication assignment|
27
-
|**`/=`**|Division assignment|
28
-
|**`%=`**|Remainder assignment|
29
-
|**`+=`**|Addition assignment|
30
-
|**`-=`**|Subtraction assignment|
31
-
|**`<<=`**|Left-shift assignment|
32
-
|**`>>=`**|Right-shift assignment|
33
-
|**`&=`**|Bitwise-AND assignment|
34
-
|**`^=`**|Bitwise-exclusive-OR assignment|
35
-
|**`|=`**|Bitwise-inclusive-OR assignment|
23
+
|Operator|Operation Performed|
24
+
|---|---|
25
+
|**`=`**|Simple assignment|
26
+
|**`*=`**|Multiplication assignment|
27
+
|**`/=`**|Division assignment|
28
+
|**`%=`**|Remainder assignment|
29
+
|**`+=`**|Addition assignment|
30
+
|**`-=`**|Subtraction assignment|
31
+
|**`<<=`**|Left-shift assignment|
32
+
|**`>>=`**|Right-shift assignment|
33
+
|**`&=`**|Bitwise-AND assignment|
34
+
|**`^=`**|Bitwise-exclusive-OR assignment|
35
+
|**`|=`**|Bitwise-inclusive-OR assignment|
36
36
37
37
In assignment, the type of the right-hand value is converted to the type of the left-hand value, and the value is stored in the left operand after the assignment has taken place. The left operand must not be an array, a function, or a constant. The specific conversion path, which depends on the two types, is outlined in detail in [Type Conversions](../c-language/type-conversions-c.md).
0 commit comments