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/reinterpret-cast-operator.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,6 @@ Output:
76
76
77
77
The **reinterpret_cast** allows the pointer to be treated as an integral type. The result is then bit-shifted and XORed with itself to produce a unique index (unique to a high degree of probability). The index is then truncated by a standard C-style cast to the return type of the function.
Copy file name to clipboardExpand all lines: docs/cpp/relational-operators-equal-and-equal.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,25 +61,25 @@ int main() {
61
61
The usual arithmetic conversions covered in [Standard Conversions](standard-conversions.md) are applied to operands of arithmetic types.
62
62
63
63
## Comparing pointers
64
-
When two pointers to objects of the same type are compared, the result is determined by the location of the objects pointed to in the program's address space. Pointers can also be compared to a constant expression that evaluates to 0 or to a pointer of type void *. If a pointer comparison is made against a pointer of type void \*, the other pointer is implicitly converted to type void \*. Then the comparison is made.
64
+
When two pointers to objects of the same type are compared, the result is determined by the location of the objects pointed to in the program's address space. Pointers can also be compared to a constant expression that evaluates to 0 or to a pointer of type `void *`. If a pointer comparison is made against a pointer of type `void *`, the other pointer is implicitly converted to type `void *`. Then the comparison is made.
65
65
66
66
Two pointers of different types cannot be compared unless:
67
67
68
68
- One type is a class type derived from the other type.
69
69
70
-
- At least one of the pointers is explicitly converted (cast) to type void *. (The other pointer is implicitly converted to type void \* for the conversion.)
70
+
- At least one of the pointers is explicitly converted (cast) to type `void *`. (The other pointer is implicitly converted to type `void *` for the conversion.)
71
71
72
72
Two pointers of the same type that point to the same object are guaranteed to compare equal. If two pointers to nonstatic members of an object are compared, the following rules apply:
73
73
74
-
- If the class type is not a union, and if the two members are not separated by an *access-specifier*, such as public, protected, or private, the pointer to the member declared last will compare greater than the pointer to the member declared earlier.
74
+
- If the class type is not a **union**, and if the two members are not separated by an *access-specifier*, such as **public**, **protected**, or **private**, the pointer to the member declared last will compare greater than the pointer to the member declared earlier.
75
75
76
76
- If the two members are separated by an *access-specifier*, the results are undefined.
77
77
78
-
- If the class type is a union, pointers to different data members in that union compare equal.
78
+
- If the class type is a **union**, pointers to different data members in that **union** compare equal.
79
79
80
80
If two pointers point to elements of the same array or to the element one beyond the end of the array, the pointer to the object with the higher subscript compares higher. Comparison of pointers is guaranteed valid only when the pointers refer to objects in the same array or to the location one past the end of the array.
81
81
82
-
## See Also
82
+
## See also
83
83
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)
84
84
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
85
85
[C Relational and Equality Operators](../c-language/c-relational-and-equality-operators.md)
Copy file name to clipboardExpand all lines: docs/cpp/resolving-ambiguous-declarations-cpp.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ To perform explicit conversions from one type to another, you must use casts, sp
17
17
char *aName( String( s ) );
18
18
```
19
19
20
-
It is unclear whether it is a function declaration or an object declaration with a function-style cast as the initializer: It could declare a function returning type **char \*** that takes one argument of type `String`, or it could declare the object `aName` and initialize it with the value of `s` cast to type `String`.
20
+
It is unclear whether it is a function declaration or an object declaration with a function-style cast as the initializer: It could declare a function returning type `char *` that takes one argument of type `String`, or it could declare the object `aName` and initialize it with the value of `s` cast to type `String`.
21
21
22
22
If a declaration can be considered a valid function declaration, it is treated as such. Only if it cannot possibly be a function declaration — that is, if it would be syntactically incorrect — is a statement examined to see if it is a function-style type cast. Therefore, the compiler considers the statement to be a declaration of a function and ignores the parentheses around the identifier `s`. On the other hand, the statements:
23
23
@@ -31,7 +31,4 @@ char *aName( (String)s );
31
31
char *aName = String( s );
32
32
```
33
33
34
-
are clearly declarations of objects, and a user-defined conversion from type `String` to type **char \*** is invoked to perform the initialization of `aName`.
35
-
36
-
## See Also
37
-
34
+
are clearly declarations of objects, and a user-defined conversion from type `String` to type `char *` is invoked to perform the initialization of `aName`.
Copy file name to clipboardExpand all lines: docs/cpp/restrict.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,17 @@ ms.workload: ["cplusplus"]
16
16
17
17
**Microsoft Specific**
18
18
19
-
When applied to a function declaration or definition that returns a pointer type, `restrict` tells the compiler that the function returns an object that is not *aliased*, that is, referenced by any other pointers. This allows the compiler to perform additional optimizations.
19
+
When applied to a function declaration or definition that returns a pointer type, **restrict** tells the compiler that the function returns an object that is not *aliased*, that is, referenced by any other pointers. This allows the compiler to perform additional optimizations.
The compiler propagates `__declspec(restrict)`. For example, the CRT `malloc` function has a `__declspec(restrict)` decoration, and therefore, the compiler assumes that pointers initialized to memory locations by `malloc` are also not aliased by previously existing pointers.
27
+
The compiler propagates **__declspec(restrict)**. For example, the CRT `malloc` function has a **__declspec(restrict)** decoration, and therefore, the compiler assumes that pointers initialized to memory locations by `malloc` are also not aliased by previously existing pointers.
28
28
29
-
The compiler does not check that the returned pointer is not actually aliased. It is the developer's responsibility to ensure the program does not alias a pointer marked with the `restrict __declspec` modifier.
29
+
The compiler does not check that the returned pointer is not actually aliased. It is the developer's responsibility to ensure the program does not alias a pointer marked with the **restrict __declspec** modifier.
30
30
31
31
For similar semantics on variables, see [__restrict](../cpp/extension-restrict.md).
32
32
@@ -36,9 +36,9 @@ For information about the **restrict** keyword that is part of C++ AMP, see [res
36
36
37
37
## Example
38
38
39
-
The following sample demonstrates the use of `__declspec(restrict)`.
39
+
The following sample demonstrates the use of **__declspec(restrict)**.
40
40
41
-
When `__declspec(restrict)` is applied to a function that returns a pointer, this tells the compiler that the memory pointed to by the return value is not aliased. In this example, the pointers `mempool` and `memptr` are global, so the compiler can't be sure that the memory they refer to is not aliased. However, they are used within `ma` and its caller `init` in a way that returns memory that isn't otherwise referenced by the program, so `__decslpec(restrict)` is used to help the optimizer. This is similar to how the CRT headers decorate allocation functions such as `malloc` by using `__declspec(restrict)` to indicate that they always return memory that cannot be aliased by existing pointers.
41
+
When **__declspec(restrict)** is applied to a function that returns a pointer, this tells the compiler that the memory pointed to by the return value is not aliased. In this example, the pointers `mempool` and `memptr` are global, so the compiler can't be sure that the memory they refer to is not aliased. However, they are used within `ma` and its caller `init` in a way that returns memory that isn't otherwise referenced by the program, so **__decslpec(restrict)** is used to help the optimizer. This is similar to how the CRT headers decorate allocation functions such as `malloc` by using **__declspec(restrict)** to indicate that they always return memory that cannot be aliased by existing pointers.
Copy file name to clipboardExpand all lines: docs/cpp/restrictions-on-exception-handlers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,6 @@ ms.workload: ["cplusplus"]
14
14
# Restrictions on Exception Handlers
15
15
The principal limitation to using exception handlers in code is that you cannot use a **goto** statement to jump into a **__try** statement block. Instead, you must enter the statement block through normal flow of control. You can jump out of a **__try** statement block and nest exception handlers as you choose.
16
16
17
-
## See Also
17
+
## See also
18
18
[Writing an Exception Handler](../cpp/writing-an-exception-handler.md)
Copy file name to clipboardExpand all lines: docs/cpp/restrictions-on-termination-handlers.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,6 @@ You cannot use a **goto** statement to jump into a **__try** statement block or
18
18
19
19
A **return** statement inside a **__finally** statement block presents roughly the same situation. Control returns to the immediate caller of the function containing the termination handler. If the system was unwinding the stack, this process is halted, and the program proceeds as if there had been no exception raised.
20
20
21
-
## See Also
21
+
## See also
22
22
[Writing a Termination Handler](../cpp/writing-a-termination-handler.md)
0 commit comments