Skip to content

Commit 5768263

Browse files
author
Colin Robertson
committed
Fix Markdig issues in CPP
1 parent e31affb commit 5768263

File tree

405 files changed

+26116
-24831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

405 files changed

+26116
-24831
lines changed

docs/cpp/abort-function.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ ms.workload: ["cplusplus"]
1616
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*.
1717

1818
## See also
19+
1920
[Program Termination](../cpp/program-termination.md)

docs/cpp/abstract-classes-cpp.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ When the object pointed to by `pDerived` is deleted, the destructor for class `d
8484
> 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.
8585

8686
## See also
87-
[Inheritance](../cpp/inheritance-cpp.md)
87+
88+
[Inheritance](../cpp/inheritance-cpp.md)

docs/cpp/additional-startup-considerations.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# 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).)
16-
17-
The following initializations take place prior to entry to `main`:
18-
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-
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-
23-
**Microsoft Specific**
24-
25-
In Microsoft C++, global static objects are initialized before entry to `main`.
26-
27-
**END Microsoft Specific**
28-
29-
Global static objects that are mutually interdependent but in different translation units may cause incorrect behavior.
30-
31-
## See also
32-
[Startup and Termination](../cpp/startup-and-termination-cpp.md)
15+
16+
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).)
17+
18+
The following initializations take place prior to entry to `main`:
19+
20+
- 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.
21+
22+
- 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.
23+
24+
**Microsoft Specific**
25+
26+
In Microsoft C++, global static objects are initialized before entry to `main`.
27+
28+
**END Microsoft Specific**
29+
30+
Global static objects that are mutually interdependent but in different translation units may cause incorrect behavior.
31+
32+
## See also
33+
34+
[Startup and Termination](../cpp/startup-and-termination-cpp.md)

docs/cpp/additional-termination-considerations.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# 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.
16-
17-
## See also
18-
[Startup and Termination](../cpp/startup-and-termination-cpp.md)
15+
16+
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.
17+
18+
## See also
19+
20+
[Startup and Termination](../cpp/startup-and-termination-cpp.md)

docs/cpp/additive-operators-plus-and.md

Lines changed: 97 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -13,96 +13,101 @@ ms.author: "mblome"
1313
ms.workload: ["cplusplus"]
1414
---
1515
# Additive Operators: + and -
16-
## Syntax
17-
18-
```
19-
expression + expression 
20-
expression - expression
21-
```
22-
23-
## Remarks
24-
The additive operators are:
25-
26-
- Addition (**+**)
27-
28-
- Subtraction (**-**)
29-
30-
These binary operators have left-to-right associativity.
31-
32-
The additive operators take operands of arithmetic or pointer types. The result of the addition (**+**) operator is the sum of the operands. The result of the subtraction (**-**) operator is the difference between the operands. If one or both of the operands are pointers, they must be pointers to objects, not to functions. If both operands are pointers, the results are not meaningful unless both are pointers to objects in the same array.
33-
34-
Additive operators take operands of *arithmetic*, *integral*, and *scalar* types. These are defined in the following table.
35-
36-
### Types Used with Additive Operators
37-
38-
|Type|Meaning|
39-
|----------|-------------|
40-
|*arithmetic*|Integral and floating types are collectively called "arithmetic" types.|
41-
|*integral*|Types char and int of all sizes (long, short) and enumerations are "integral" types.|
42-
|*scalar*|Scalar operands are operands of either arithmetic or pointer type.|
43-
44-
The legal combinations for these operators are:
45-
46-
*arithmetic* + *arithmetic*
47-
48-
*scalar* + *integral*
49-
50-
*integral* + *scalar*
51-
52-
*arithmetic* - *arithmetic*
53-
54-
*scalar* - *scalar*
55-
56-
Note that addition and subtraction are not equivalent operations.
57-
58-
If both operands are of arithmetic type, the conversions covered in [Standard Conversions](standard-conversions.md) are applied to the operands, and the result is of the converted type.
59-
60-
## Example
61-
62-
```cpp
63-
// expre_Additive_Operators.cpp
64-
// compile with: /EHsc
65-
#include <iostream>
66-
#define SIZE 5
67-
using namespace std;
68-
int main() {
69-
int i = 5, j = 10;
70-
int n[SIZE] = { 0, 1, 2, 3, 4 };
71-
cout << "5 + 10 = " << i + j << endl
72-
<< "5 - 10 = " << i - j << endl;
73-
74-
// use pointer arithmetic on array
75-
76-
cout << "n[3] = " << *( n + 3 ) << endl;
77-
}
78-
```
79-
80-
## Pointer addition
81-
If one of the operands in an addition operation is a pointer to an array of objects, the other must be of integral type. The result is a pointer that is of the same type as the original pointer and that points to another array element. The following code fragment illustrates this concept:
82-
83-
```cpp
84-
short IntArray[10]; // Objects of type short occupy 2 bytes
85-
short *pIntArray = IntArray;
86-
87-
for( int i = 0; i < 10; ++i )
88-
{
89-
*pIntArray = i;
90-
cout << *pIntArray << "\n";
91-
pIntArray = pIntArray + 1;
92-
}
93-
```
94-
95-
Although the integral value 1 is added to `pIntArray`, it does not mean "add 1 to the address"; rather it means "adjust the pointer to point to the next object in the array" that happens to be 2 bytes (or `sizeof( int )`) away.
96-
16+
17+
## Syntax
18+
19+
```
20+
expression + expression 
21+
expression - expression
22+
```
23+
24+
## Remarks
25+
26+
The additive operators are:
27+
28+
- Addition (**+**)
29+
30+
- Subtraction (**-**)
31+
32+
These binary operators have left-to-right associativity.
33+
34+
The additive operators take operands of arithmetic or pointer types. The result of the addition (**+**) operator is the sum of the operands. The result of the subtraction (**-**) operator is the difference between the operands. If one or both of the operands are pointers, they must be pointers to objects, not to functions. If both operands are pointers, the results are not meaningful unless both are pointers to objects in the same array.
35+
36+
Additive operators take operands of *arithmetic*, *integral*, and *scalar* types. These are defined in the following table.
37+
38+
### Types Used with Additive Operators
39+
40+
|Type|Meaning|
41+
|----------|-------------|
42+
|*arithmetic*|Integral and floating types are collectively called "arithmetic" types.|
43+
|*integral*|Types char and int of all sizes (long, short) and enumerations are "integral" types.|
44+
|*scalar*|Scalar operands are operands of either arithmetic or pointer type.|
45+
46+
The legal combinations for these operators are:
47+
48+
*arithmetic* + *arithmetic*
49+
50+
*scalar* + *integral*
51+
52+
*integral* + *scalar*
53+
54+
*arithmetic* - *arithmetic*
55+
56+
*scalar* - *scalar*
57+
58+
Note that addition and subtraction are not equivalent operations.
59+
60+
If both operands are of arithmetic type, the conversions covered in [Standard Conversions](standard-conversions.md) are applied to the operands, and the result is of the converted type.
61+
62+
## Example
63+
64+
```cpp
65+
// expre_Additive_Operators.cpp
66+
// compile with: /EHsc
67+
#include <iostream>
68+
#define SIZE 5
69+
using namespace std;
70+
int main() {
71+
int i = 5, j = 10;
72+
int n[SIZE] = { 0, 1, 2, 3, 4 };
73+
cout << "5 + 10 = " << i + j << endl
74+
<< "5 - 10 = " << i - j << endl;
75+
76+
// use pointer arithmetic on array
77+
78+
cout << "n[3] = " << *( n + 3 ) << endl;
79+
}
80+
```
81+
82+
## Pointer addition
83+
84+
If one of the operands in an addition operation is a pointer to an array of objects, the other must be of integral type. The result is a pointer that is of the same type as the original pointer and that points to another array element. The following code fragment illustrates this concept:
85+
86+
```cpp
87+
short IntArray[10]; // Objects of type short occupy 2 bytes
88+
short *pIntArray = IntArray;
89+
90+
for( int i = 0; i < 10; ++i )
91+
{
92+
*pIntArray = i;
93+
cout << *pIntArray << "\n";
94+
pIntArray = pIntArray + 1;
95+
}
96+
```
97+
98+
Although the integral value 1 is added to `pIntArray`, it does not mean "add 1 to the address"; rather it means "adjust the pointer to point to the next object in the array" that happens to be 2 bytes (or `sizeof( int )`) away.
99+
97100
> [!NOTE]
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-
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>).
102-
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-
105-
## See also
106-
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)
107-
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
108-
[C Additive Operators](../c-language/c-additive-operators.md)
101+
> 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`.
102+
103+
## Pointer subtraction
104+
105+
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>).
106+
107+
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.
108+
109+
## See also
110+
111+
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)<br/>
112+
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)<br/>
113+
[C Additive Operators](../c-language/c-additive-operators.md)

0 commit comments

Comments
 (0)