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
Copy file name to clipboardExpand all lines: docs/cpp/dllexport-dllimport.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.workload: ["cplusplus"]
15
15
# dllexport, dllimport
16
16
**Microsoft Specific**
17
17
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.
19
19
20
20
## Syntax
21
21
@@ -26,15 +26,15 @@ ms.workload: ["cplusplus"]
26
26
```
27
27
28
28
## 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.
30
30
31
31
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.
32
32
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.
34
34
35
35
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.
36
36
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.
Copy file name to clipboardExpand all lines: docs/cpp/do-while-statement-cpp.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -24,16 +24,16 @@ while ( expression ) ;
24
24
```
25
25
26
26
## 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.
28
28
29
29
The *expression* must have arithmetic or pointer type. Execution proceeds as follows:
30
30
31
31
1. The statement body is executed.
32
32
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.
34
34
35
35
## Example
36
-
The following sample demonstrates the `do-while` statement:
36
+
The following sample demonstrates the **do-while** statement:
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.
29
29
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:
31
31
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.
33
33
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.
35
35
36
36
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:
37
37
@@ -94,9 +94,9 @@ void f() {
94
94
95
95
In cases of multiple inheritance, possibilities for ambiguity are introduced. Consider the class hierarchy shown in the following figure.
96
96
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.
98
98
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:
100
100
101
101
```cpp
102
102
// dynamic_cast_clr.cpp
@@ -143,14 +143,14 @@ void f() {
143
143

144
144
Class Hierarchy Showing Virtual Base Classes
145
145
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.
147
147
148
148
Consider the class hierarchy shown in the following figure.
149
149
150
150

151
151
Class Hierarchy Showing Duplicate Base Classes
152
152
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:
154
154
155
155
```cpp
156
156
// dynamic_cast_5.cpp
@@ -168,7 +168,7 @@ void f(D* pd) {
168
168
}
169
169
```
170
170
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`.
172
172
173
173
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:
174
174
@@ -187,7 +187,7 @@ void f(D* pd) {
187
187
}
188
188
```
189
189
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**.
191
191
192
192
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:
Copy file name to clipboardExpand all lines: docs/cpp/enumerations-cpp.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ ms.workload: ["cplusplus"]
16
16
An enumeration is a user-defined type that consists of a set of named integral constants that are known as enumerators.
17
17
18
18
> [!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).
20
20
21
21
## Syntax
22
22
@@ -39,17 +39,17 @@ enum class C : short; // ... may have any integral underlying type
39
39
```
40
40
41
41
## Parameters
42
-
`identifier`
42
+
*identifier*
43
43
The type name given to the enumeration.
44
44
45
-
`type`
45
+
*type*
46
46
The underlying type of the enumerators; all enumerators have the same underlying type. May be any integral type.
47
47
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.
50
50
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.
53
53
54
54
## Enumerator scope
55
55
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:
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`:
102
102
103
103
```cpp
104
104
int account_num = 135692;
@@ -107,7 +107,7 @@ hand = account_num; // error C2440: '=' : cannot convert from 'int' to 'Suit'
107
107
108
108
```
109
109
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.
111
111
112
112
```cpp
113
113
int account_num = Hearts; //OK if Hearts is in a unscoped enum
Copy file name to clipboardExpand all lines: docs/cpp/equality-operators-equal-equal-and-exclpt-equal.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -23,9 +23,9 @@ expression != expression
23
23
## Remarks
24
24
The binary equality operators compare their operands for strict equality or inequality.
25
25
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**.
27
27
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.
29
29
30
30
## Operator Keyword for !=
31
31
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