Skip to content

Commit ad569ac

Browse files
author
mtx48109
committed
format cpp pr4
1 parent 8fc0df5 commit ad569ac

34 files changed

+192
-192
lines changed

docs/cpp/dllexport-dllimport.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.workload: ["cplusplus"]
1515
# dllexport, dllimport
1616
**Microsoft Specific**
1717

18-
The `dllexport` and **dllimport** storage-class attributes are Microsoft-specific extensions to the C and C++ languages. You can use them to export and import functions, data, and objects to or from a DLL.
18+
The **dllexport** and **dllimport** storage-class attributes are Microsoft-specific extensions to the C and C++ languages. You can use them to export and import functions, data, and objects to or from a DLL.
1919

2020
## Syntax
2121

@@ -26,15 +26,15 @@ ms.workload: ["cplusplus"]
2626
```
2727

2828
## Remarks
29-
These attributes explicitly define the DLL's interface to its client, which can be the executable file or another DLL. Declaring functions as `dllexport` eliminates the need for a module-definition (.def) file, at least with respect to the specification of exported functions. The `dllexport` attribute replaces the `__export` keyword.
29+
These attributes explicitly define the DLL's interface to its client, which can be the executable file or another DLL. Declaring functions as **dllexport** eliminates the need for a module-definition (.def) file, at least with respect to the specification of exported functions. The **dllexport** attribute replaces the **__export** keyword.
3030

3131
If a class is marked declspec(dllexport), any specializations of class templates in the class hierarchy are implicitly marked as declspec(dllexport). This means that class templates are explicitly instantiated and the class's members must be defined.
3232

33-
`dllexport` of a function exposes the function with its decorated name. For C++ functions, this includes name mangling. For C functions or functions that are declared as `extern "C"`, this includes platform-specific decoration that's based on the calling convention. For information on name decoration in C/C++ code, see [Decorated Names](../build/reference/decorated-names.md). No name decoration is applied to exported C functions or C++ `extern "C"` functions using the `__cdecl` calling convention.
33+
**dllexport** of a function exposes the function with its decorated name. For C++ functions, this includes name mangling. For C functions or functions that are declared as `extern "C"`, this includes platform-specific decoration that's based on the calling convention. For information on name decoration in C/C++ code, see [Decorated Names](../build/reference/decorated-names.md). No name decoration is applied to exported C functions or C++ `extern "C"` functions using the `__cdecl` calling convention.
3434

3535
To export an undecorated name, you can link by using a Module Definition (.def) file that defines the undecorated name in an EXPORTS section. For more information, see [EXPORTS](../build/reference/exports.md). Another way to export an undecorated name is to use a `#pragma comment(linker, "/export:alias=decorated_name")` directive in the source code.
3636

37-
When you declare `dllexport` or **dllimport**, you must use [extended attribute syntax](../cpp/declspec.md) and the `__declspec` keyword.
37+
When you declare **dllexport** or **dllimport**, you must use [extended attribute syntax](../cpp/declspec.md) and the **__declspec** keyword.
3838

3939
## Example
4040

docs/cpp/do-while-statement-cpp.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ while ( expression ) ;
2424
```
2525

2626
## Remarks
27-
The test of the termination condition is made after each execution of the loop; therefore, a `do-while` loop executes one or more times, depending on the value of the termination expression. The `do-while` statement can also terminate when a [break](../cpp/break-statement-cpp.md), [goto](../cpp/goto-statement-cpp.md), or [return](../cpp/return-statement-cpp.md) statement is executed within the statement body.
27+
The test of the termination condition is made after each execution of the loop; therefore, a **do-while** loop executes one or more times, depending on the value of the termination expression. The **do-while** statement can also terminate when a [break](../cpp/break-statement-cpp.md), [goto](../cpp/goto-statement-cpp.md), or [return](../cpp/return-statement-cpp.md) statement is executed within the statement body.
2828

2929
The *expression* must have arithmetic or pointer type. Execution proceeds as follows:
3030

3131
1. The statement body is executed.
3232

33-
2. Next, *expression* is evaluated. If *expression* is false, the `do-while` statement terminates and control passes to the next statement in the program. If *expression* is true (nonzero), the process is repeated, beginning with step 1.
33+
2. Next, *expression* is evaluated. If *expression* is false, the **do-while** statement terminates and control passes to the next statement in the program. If *expression* is true (nonzero), the process is repeated, beginning with step 1.
3434

3535
## Example
36-
The following sample demonstrates the `do-while` statement:
36+
The following sample demonstrates the **do-while** statement:
3737

3838
```cpp
3939
// do_while_statement.cpp

docs/cpp/dynamic-cast-operator.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ dynamic_cast < type-id > ( expression )
2727

2828
See [static_cast](../cpp/static-cast-operator.md) for an explanation of the difference between static and dynamic casting conversions, and when it is appropriate to use each.
2929

30-
There are two breaking changes in the behavior of `dynamic_cast` in managed code:
30+
There are two breaking changes in the behavior of **dynamic_cast** in managed code:
3131

32-
- `dynamic_cast` to a pointer to the underlying type of a boxed enum will fail at runtime, returning 0 instead of the converted pointer.
32+
- **dynamic_cast** to a pointer to the underlying type of a boxed enum will fail at runtime, returning 0 instead of the converted pointer.
3333

34-
- `dynamic_cast` will no longer throw an exception when `type-id` is an interior pointer to a value type, with the cast failing at runtime. The cast will now return the 0 pointer value instead of throwing.
34+
- **dynamic_cast** will no longer throw an exception when `type-id` is an interior pointer to a value type, with the cast failing at runtime. The cast will now return the 0 pointer value instead of throwing.
3535

3636
If `type-id` is a pointer to an unambiguous accessible direct or indirect base class of `expression`, a pointer to the unique subobject of type `type-id` is the result. For example:
3737

@@ -94,9 +94,9 @@ void f() {
9494
9595
In cases of multiple inheritance, possibilities for ambiguity are introduced. Consider the class hierarchy shown in the following figure.
9696
97-
For CLR types, `dynamic_cast` results in either a no-op if the conversion can be performed implicitly, or an MSIL `isinst` instruction, which performs a dynamic check and returns `nullptr` if the conversion fails.
97+
For CLR types, **dynamic_cast** results in either a no-op if the conversion can be performed implicitly, or an MSIL `isinst` instruction, which performs a dynamic check and returns **nullptr** if the conversion fails.
9898
99-
The following sample uses `dynamic_cast` to determine if a class is an instance of particular type:
99+
The following sample uses **dynamic_cast** to determine if a class is an instance of particular type:
100100
101101
```cpp
102102
// dynamic_cast_clr.cpp
@@ -143,14 +143,14 @@ void f() {
143143
![Class hierarchy that shows virtual base classes](../cpp/media/vc39012.gif "vc39012")
144144
Class Hierarchy Showing Virtual Base Classes
145145
146-
In this hierarchy, `A` is a virtual base class. Given an instance of class `E` and a pointer to the `A` subobject, a `dynamic_cast` to a pointer to `B` will fail due to ambiguity. You must first cast back to the complete `E` object, then work your way back up the hierarchy, in an unambiguous manner, to reach the correct `B` object.
146+
In this hierarchy, `A` is a virtual base class. Given an instance of class `E` and a pointer to the `A` subobject, a **dynamic_cast** to a pointer to `B` will fail due to ambiguity. You must first cast back to the complete `E` object, then work your way back up the hierarchy, in an unambiguous manner, to reach the correct `B` object.
147147
148148
Consider the class hierarchy shown in the following figure.
149149
150150
![Class hierarchy that shows duplicate base classes](../cpp/media/vc39013.gif "vc39013")
151151
Class Hierarchy Showing Duplicate Base Classes
152152
153-
Given an object of type `E` and a pointer to the `D` subobject, to navigate from the `D` subobject to the left-most `A` subobject, three conversions can be made. You can perform a `dynamic_cast` conversion from the `D` pointer to an `E` pointer, then a conversion (either `dynamic_cast` or an implicit conversion) from `E` to `B`, and finally an implicit conversion from `B` to `A`. For example:
153+
Given an object of type `E` and a pointer to the `D` subobject, to navigate from the `D` subobject to the left-most `A` subobject, three conversions can be made. You can perform a **dynamic_cast** conversion from the `D` pointer to an `E` pointer, then a conversion (either **dynamic_cast** or an implicit conversion) from `E` to `B`, and finally an implicit conversion from `B` to `A`. For example:
154154
155155
```cpp
156156
// dynamic_cast_5.cpp
@@ -168,7 +168,7 @@ void f(D* pd) {
168168
}
169169
```
170170

171-
The `dynamic_cast` operator can also be used to perform a "cross cast." Using the same class hierarchy, it is possible to cast a pointer, for example, from the `B` subobject to the `D` subobject, as long as the complete object is of type `E`.
171+
The **dynamic_cast** operator can also be used to perform a "cross cast." Using the same class hierarchy, it is possible to cast a pointer, for example, from the `B` subobject to the `D` subobject, as long as the complete object is of type `E`.
172172

173173
Considering cross casts, it is actually possible to do the conversion from a pointer to `D` to a pointer to the left-most `A` subobject in just two steps. You can perform a cross cast from `D` to `B`, then an implicit conversion from `B` to `A`. For example:
174174

@@ -187,7 +187,7 @@ void f(D* pd) {
187187
}
188188
```
189189
190-
A null pointer value is converted to the null pointer value of the destination type by `dynamic_cast`.
190+
A null pointer value is converted to the null pointer value of the destination type by **dynamic_cast**.
191191
192192
When you use `dynamic_cast < type-id > ( expression )`, if `expression` cannot be safely converted to type `type-id`, the run-time check causes the cast to fail. For example:
193193

docs/cpp/ellipses-and-variadic-templates.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ template <typename... Arguments> returntype functionname(Arguments&&... args);
7373
template <typename... Arguments> returntype functionname(Arguments*... args);
7474
```
7575

76-
Specifiers like `const` are also allowed:
76+
Specifiers like **const** are also allowed:
7777

7878
```cpp
7979
template <typename... Arguments> returntype functionname(const Arguments&... args);

docs/cpp/enumerations-cpp.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.workload: ["cplusplus"]
1616
An enumeration is a user-defined type that consists of a set of named integral constants that are known as enumerators.
1717

1818
> [!NOTE]
19-
> This article covers the ISO Standard C++ Language `enum` type and the scoped (or strongly-typed) `enum class` type which is introduced in C++11. For information about the `public enum class` or `private enum class` types in C++/CLI and C++/CX, see [enum class](../windows/enum-class-cpp-component-extensions.md).
19+
> This article covers the ISO Standard C++ Language **enum** type and the scoped (or strongly-typed) **enum class** type which is introduced in C++11. For information about the **public enum class** or **private enum class** types in C++/CLI and C++/CX, see [enum class](../windows/enum-class-cpp-component-extensions.md).
2020
2121
## Syntax
2222

@@ -39,17 +39,17 @@ enum class C : short; // ... may have any integral underlying type
3939
```
4040
4141
## Parameters
42-
`identifier`
42+
*identifier*
4343
The type name given to the enumeration.
4444
45-
`type`
45+
*type*
4646
The underlying type of the enumerators; all enumerators have the same underlying type. May be any integral type.
4747
48-
`enum-list`
49-
Comma-separated list of the enumerators in the enumeration. Every enumerator or variable name in the scope must be unique. However, the values can be duplicated. In a unscoped enum, the scope is the surrounding scope; in a scoped enum, the scope is the `enum-list` itself. In a scoped enum, the list may be empty which in effect defines a new integral type.
48+
*enum-list*
49+
Comma-separated list of the enumerators in the enumeration. Every enumerator or variable name in the scope must be unique. However, the values can be duplicated. In a unscoped enum, the scope is the surrounding scope; in a scoped enum, the scope is the *enum-list* itself. In a scoped enum, the list may be empty which in effect defines a new integral type.
5050
51-
`class`
52-
By using this keyword in the declaration, you specify the enum is scoped, and an `identifier` must be provided. You can also use the `struct` keyword in place of `class`, as they are semantically equivalent in this context.
51+
*class*
52+
By using this keyword in the declaration, you specify the enum is scoped, and an *identifier* must be provided. You can also use the **struct** keyword in place of **class**, as they are semantically equivalent in this context.
5353
5454
## Enumerator scope
5555
An enumeration provides context to describe a range of values which are represented as named constants and are also called enumerators. In the original C and C++ enum types, the unqualified enumerators are visible throughout the scope in which the enum is declared. In scoped enums, the enumerator name must be qualified by the enum type name. The following example demonstrates this basic difference between the two kinds of enums:
@@ -98,7 +98,7 @@ enum Suit { Diamonds = 5, Hearts, Clubs = 4, Spades };
9898

9999
## Casting rules
100100

101-
Unscoped enum constants can be implicitly converted to `int`, but an `int` is never implicitly convertible to an enum value. The following example shows what happens if you try to assign `hand` a value that is not a `Suit`:
101+
Unscoped enum constants can be implicitly converted to **int**, but an **int** is never implicitly convertible to an enum value. The following example shows what happens if you try to assign `hand` a value that is not a `Suit`:
102102

103103
```cpp
104104
int account_num = 135692;
@@ -107,7 +107,7 @@ hand = account_num; // error C2440: '=' : cannot convert from 'int' to 'Suit'
107107

108108
```
109109

110-
A cast is required to convert an `int` to a scoped or unscoped enumerator. However, you can promote a unscoped enumerator to an integer value without a cast.
110+
A cast is required to convert an **int** to a scoped or unscoped enumerator. However, you can promote a unscoped enumerator to an integer value without a cast.
111111

112112
```cpp
113113
int account_num = Hearts; //OK if Hearts is in a unscoped enum

docs/cpp/equality-operators-equal-equal-and-exclpt-equal.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ expression != expression
2323
## Remarks
2424
The binary equality operators compare their operands for strict equality or inequality.
2525

26-
The equality operators, equal to (`==`) and not equal to (`!=`), have lower precedence than the relational operators, but they behave similarly. The result type for these operators is `bool`.
26+
The equality operators, equal to (`==`) and not equal to (`!=`), have lower precedence than the relational operators, but they behave similarly. The result type for these operators is **bool**.
2727

28-
The equal-to operator (`==`) returns **true** (1) if both operands have the same value; otherwise, it returns **false** (0). The not-equal-to operator (`!=`) returns **true** if the operands do not have the same value; otherwise, it returns **false**.
28+
The equal-to operator (`==`) returns TRUE (1) if both operands have the same value; otherwise, it returns FALSE (0). The not-equal-to operator (`!=`) returns TRUE if the operands do not have the same value; otherwise, it returns FALSE.
2929

3030
## Operator Keyword for !=
3131
The `not_eq` operator is the text equivalent of `!=`. There are two ways to access the `not_eq` operator in your programs: include the header file `iso646.h`, or compile with the [/Za](../build/reference/za-ze-disable-language-extensions.md) (Disable language extensions) compiler option.

0 commit comments

Comments
 (0)