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/abort-function.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,7 @@ ms.workload: ["cplusplus"]
13
13
---
14
14
# abort Function
15
15
16
-
The **abort** function, also declared in the standard include file \<stdlib.h>, terminates a C++ program. The difference between **exit** and **abort** is that **exit** allows the C++ run-time termination processing to take place (global object destructors will be called), whereas **abort** terminates the program immediately. For more information, see [abort](../c-runtime-library/reference/abort.md) in the *Run-Time Library Reference*.
16
+
The **abort** function, also declared in the standard include file \<stdlib.h>, terminates a C++ program. The difference between `exit` and **abort** is that `exit` allows the C++ run-time termination processing to take place (global object destructors will be called), whereas **abort** terminates the program immediately. For more information, see [abort](../c-runtime-library/reference/abort.md) in the *Run-Time Library Reference*.
Copy file name to clipboardExpand all lines: docs/cpp/abstract-classes-cpp.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,5 +84,4 @@ When the object pointed to by `pDerived` is deleted, the destructor for class `d
84
84
> In the preceding example, the pure virtual function `base::~base` is called implicitly from `derived::~derived`. It is also possible to call pure virtual functions explicitly using a fully qualified member-function name.
Copy file name to clipboardExpand all lines: docs/cpp/additional-startup-considerations.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
@@ -12,21 +12,21 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Additional Startup Considerations
15
-
In C++, object construction and destruction can involve executing user code. Therefore, it is important to understand which initializations happen before entry to **main** and which destructors are invoked after exit from **main**. (For detailed information about construction and destruction of objects, see [Constructors](../cpp/constructors-cpp.md) and [Destructors](../cpp/destructors-cpp.md).)
15
+
In C++, object construction and destruction can involve executing user code. Therefore, it is important to understand which initializations happen before entry to `main` and which destructors are invoked after exit from `main`. (For detailed information about construction and destruction of objects, see [Constructors](../cpp/constructors-cpp.md) and [Destructors](../cpp/destructors-cpp.md).)
16
16
17
-
The following initializations take place prior to entry to **main**:
17
+
The following initializations take place prior to entry to `main`:
18
18
19
19
- Default initialization of static data to zero. All static data without explicit initializers are set to zero prior to executing any other code, including run-time initialization. Static data members must still be explicitly defined.
20
20
21
-
- Initialization of global static objects in a translation unit. This may occur either before entry to **main** or before the first use of any function or object in the object's translation unit.
21
+
- Initialization of global static objects in a translation unit. This may occur either before entry to `main` or before the first use of any function or object in the object's translation unit.
22
22
23
23
**Microsoft Specific**
24
24
25
-
In Microsoft C++, global static objects are initialized before entry to **main**.
25
+
In Microsoft C++, global static objects are initialized before entry to `main`.
26
26
27
27
**END Microsoft Specific**
28
28
29
29
Global static objects that are mutually interdependent but in different translation units may cause incorrect behavior.
30
30
31
-
## See Also
31
+
## See also
32
32
[Startup and Termination](../cpp/startup-and-termination-cpp.md)
Copy file name to clipboardExpand all lines: docs/cpp/additional-termination-considerations.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Additional Termination Considerations
15
-
You can terminate a C++ program by using **exit**, **return**, or **abort**. You can add exit processing using the `atexit` function. These are discussed in the following sections.
15
+
You can terminate a C++ program by using `exit`, **return**, or `abort`. You can add exit processing using the `atexit` function. These are discussed in the following sections.
16
16
17
-
## See Also
17
+
## See also
18
18
[Startup and Termination](../cpp/startup-and-termination-cpp.md)
Copy file name to clipboardExpand all lines: docs/cpp/additive-operators-plus-and.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,11 +98,11 @@ for( int i = 0; i < 10; ++i )
98
98
> Code of the form `pIntArray = pIntArray + 1` is rarely found in C++ programs; to perform an increment, these forms are preferable: `pIntArray++` or `pIntArray += 1`.
99
99
100
100
## Pointer subtraction
101
-
If both operands are pointers, the result of subtraction is the difference (in array elements) between the operands. The subtraction expression yields a signed integral result of type **ptrdiff_t** (defined in the standard include file \<stddef.h>).
101
+
If both operands are pointers, the result of subtraction is the difference (in array elements) between the operands. The subtraction expression yields a signed integral result of type `ptrdiff_t` (defined in the standard include file \<stddef.h>).
102
102
103
103
One of the operands can be of integral type, as long as it is the second operand. The result of the subtraction is of the same type as the original pointer. The value of the subtraction is a pointer to the (*n* - *i*)th array element, where *n* is the element pointed to by the original pointer and *i* is the integral value of the second operand.
104
104
105
-
## See Also
105
+
## See also
106
106
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)
107
107
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
Copy file name to clipboardExpand all lines: docs/cpp/address-of-operator-amp.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
@@ -24,7 +24,7 @@ ms.workload: ["cplusplus"]
24
24
25
25
The address-of operator can only be applied to variables with fundamental, structure, class, or union types that are declared at the file-scope level, or to subscripted array references. In these expressions, a constant expression that does not include the address-of operator can be added to or subtracted from the address-of expression.
26
26
27
-
When applied to functions or l-values, the result of the expression is a pointer type (an r-value) derived from the type of the operand. For example, if the operand is of type **char**, the result of the expression is of type pointer to **char**. The address-of operator, applied to **const** or **volatile** objects, evaluates to **const type \*** or **volatile type \***, where **type** is the type of the original object.
27
+
When applied to functions or l-values, the result of the expression is a pointer type (an r-value) derived from the type of the operand. For example, if the operand is of type **char**, the result of the expression is of type pointer to **char**. The address-of operator, applied to **const** or **volatile** objects, evaluates to `const type *` or `volatile type *`, where **type** is the type of the original object.
28
28
29
29
When the address-of operator is applied to a qualified name, the result depends on whether the *qualified-name* specifies a static member. If so, the result is a pointer to the type specified in the declaration of the member. If the member is not static, the result is a pointer to the member *name* of the class indicated by *qualified-class-name*. (See [Primary Expressions](../cpp/primary-expressions.md) for more about *qualified-class-name*.) The following code fragment shows how the result differs, depending on whether the member is static:
30
30
@@ -69,7 +69,7 @@ int main() {
69
69
70
70
## Output
71
71
72
-
```
72
+
```Output
73
73
&d equals &rd
74
74
```
75
75
@@ -96,12 +96,12 @@ int main() {
96
96
97
97
## Output
98
98
99
-
```
99
+
```Output
100
100
25
101
101
```
102
102
103
-
## See Also
103
+
## See also
104
104
[Expressions with Unary Operators](../cpp/expressions-with-unary-operators.md)
105
105
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
Copy file name to clipboardExpand all lines: docs/cpp/algorithms-modern-cpp.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,16 +60,16 @@ auto i = find_if( begin(v), end(v), [=](int i) { return i > x && i < y; } );
60
60
### Range-based for loops
61
61
The range-based **for** loop is a C++11 language feature, not a C++ Standard Library algorithm. But it deserves mention in this discussion about loops. Range-based **for** loops are an extension of the **for** keyword and provide a convenient and efficient way to write loops that iterate over a range of values. C++ Standard Library containers, strings, and arrays are ready-made for range-based **for** loops. To enable this new iteration syntax for your user-defined type, add the following support:
62
62
63
-
- A **begin** method that returns an iterator to the beginning of the structure and an **end** method that returns an iterator to the end of the structure.
63
+
- A `begin` method that returns an iterator to the beginning of the structure and an `end` method that returns an iterator to the end of the structure.
64
64
65
65
- Support in the iterator for these methods: **operator***, **operator!=**, and **operator++** (prefix version).
66
66
67
67
These methods can be either members or stand-alone functions.
68
68
69
69
## Random Numbers
70
-
It's no secret that the old CRT **rand()** function has many flaws, which have been discussed at length in the C++ community. In modern C++, you don't have to deal with those shortcomings—nor do you have to invent your own uniformly distributed random number generator—because the tools for quickly and easily creating them are available in the C++ Standard Library, as shown in [\<random>](../standard-library/random.md).
70
+
It's no secret that the old CRT `rand()` function has many flaws, which have been discussed at length in the C++ community. In modern C++, you don't have to deal with those shortcomings—nor do you have to invent your own uniformly distributed random number generator—because the tools for quickly and easily creating them are available in the C++ Standard Library, as shown in [\<random>](../standard-library/random.md).
71
71
72
-
## See Also
72
+
## See also
73
73
[Welcome Back to C++](../cpp/welcome-back-to-cpp-modern-cpp.md)
74
74
[C++ Language Reference](../cpp/cpp-language-reference.md)
75
75
[C++ Standard Library](../standard-library/cpp-standard-library-reference.md)
Copy file name to clipboardExpand all lines: docs/cpp/align-cpp.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ The compiler does not guarantee or attempt to preserve the alignment attribute o
38
38
39
39
You cannot specify alignment for function parameters. When data that has an alignment attribute is passed by value on the stack, its alignment is controlled by the calling convention. If data alignment is important in the called function, copy the parameter into correctly aligned memory before use.
40
40
41
-
Without `__declspec(align(#))`, the compiler generally aligns data on natural boundaries based on the target processor and the size of the data, up to 4-byte boundaries on 32-bit processors, and 8-byte boundaries on 64-bit processors. Data in classes or structures is aligned in the class or structure at the minimum of its natural alignment and the current packing setting (from #pragma **pack** or the **/Zp** compiler option).
41
+
Without `__declspec(align(#))`, the compiler generally aligns data on natural boundaries based on the target processor and the size of the data, up to 4-byte boundaries on 32-bit processors, and 8-byte boundaries on 64-bit processors. Data in classes or structures is aligned in the class or structure at the minimum of its natural alignment and the current packing setting (from #pragma `pack` or the `/Zp` compiler option).
42
42
43
43
This example demonstrates the use of `__declspec(align(#))`:
44
44
@@ -167,7 +167,7 @@ void fn() {
167
167
}
168
168
```
169
169
170
-
The alignment when memory is allocated on the heap depends on which allocation function is called. For example, if you use **malloc**, the result depends on the operand size. If *arg* >= 8, the memory returned is 8 byte aligned. If *arg* < 8, the alignment of the memory returned is the first power of 2 less than *arg*. For example, if you use malloc(7), the alignment is 4 bytes.
170
+
The alignment when memory is allocated on the heap depends on which allocation function is called. For example, if you use `malloc`, the result depends on the operand size. If *arg* >= 8, the memory returned is 8 byte aligned. If *arg* < 8, the alignment of the memory returned is the first power of 2 less than *arg*. For example, if you use malloc(7), the alignment is 4 bytes.
171
171
172
172
## <aname="vclrf_declspecaligntypedef"></a> Defining New Types with __declspec(align(#))
## <aname="vclrfhowalignworkswithdatapacking"></a> How align Works with Data Packing
209
209
210
-
The **/Zp** compiler option and the **pack** pragma have the effect of packing data for structure and union members.This example shows how **/Zp** and `__declspec(align(#))` work together:
210
+
The `/Zp` compiler option and the `pack` pragma have the effect of packing data for structure and union members.This example shows how `/Zp` and `__declspec(align(#))` work together:
211
211
212
-
```c[[]]
212
+
```cpp
213
213
structS {
214
214
char a;
215
215
short b;
@@ -220,7 +220,7 @@ struct S {
220
220
};
221
221
```
222
222
223
-
The following table lists the offset of each member under a variety of **/Zp** (or #pragma **pack**) values, showing how the two interact.
223
+
The following table lists the offset of each member under a variety of `/Zp` (or #pragma `pack`) values, showing how the two interact.
0 commit comments