Skip to content

Commit ea54848

Browse files
authored
Merge pull request #3801 from corob-msft/docs/corob/cpp-docs-3408
Address sanitizer comment location fix for cpp-docs 3408
2 parents e89e29d + 8c10adf commit ea54848

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/cpp/initializing-classes-and-structs-without-constructors-cpp.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: "Brace initialization for classes, structs, and unions"
3-
description: "Use brace initialization with any C++ class, struct or union"
4-
ms.date: "11/19/2019"
3+
description: "Use brace initialization with any C++ class, struct, or union"
4+
ms.date: 09/28/2021
55
ms.assetid: 3e55c3d6-1c6b-4084-b9e5-221b151402f4
66
---
77
# Brace initialization
88

9-
It is not always necessary to define a constructor for a class, especially ones that are relatively simple. Users can initialize objects of a class or struct by using uniform initialization, as shown in the following example:
9+
It isn't always necessary to define a constructor for a `class`, especially ones that are relatively simple. Users can initialize objects of a `class` or `struct` by using uniform initialization, as shown in the following example:
1010

1111
```cpp
1212
// no_constructor.cpp
@@ -55,7 +55,7 @@ int main()
5555
}
5656
```
5757
58-
Note that when a class or struct has no constructor, you provide the list elements in the order that the members are declared in the class. If the class has a constructor, provide the elements in the order of the parameters. If a type has a default constructor, either implicitly or explicitly declared, you can use default brace initialization (with empty braces). For example, the following class may be initialized by using both default and non-default brace initialization:
58+
When a `class` or `struct` has no constructor, you provide the list elements in the order that the members are declared in the `class`. If the `class` has a constructor, provide the elements in the order of the parameters. If a type has a default constructor, either implicitly or explicitly declared, you can use default brace initialization (with empty braces). For example, the following `class` may be initialized by using both default and non-default brace initialization:
5959
6060
```cpp
6161
#include <string>
@@ -84,7 +84,7 @@ int main()
8484
}
8585
```
8686

87-
If a class has non-default constructors, the order in which class members appear in the brace initializer is the order in which the corresponding parameters appear in the constructor, not the order in which the members are declared (as with `class_a` in the previous example). Otherwise, if the type has no declared constructor, the order in which the members appear in the brace initializer is the same as the order in which they are declared; in this case, you can initialize as many of the public members as you wish, but you cannot skip any member. The following example shows the order that's used in brace initialization when there is no declared constructor:
87+
If a class has non-default constructors, the order in which class members appear in the brace initializer is the order in which the corresponding parameters appear in the constructor, not the order in which the members are declared (as with `class_a` in the previous example). Otherwise, if the type has no declared constructor, member initializers must appear in the brace initializer in the same order as they're declared. In this case, you can initialize as many of the public members as you wish, but you can't skip any member. The following example shows the order that's used in brace initialization when there's no declared constructor:
8888

8989
```cpp
9090
class class_d {
@@ -106,7 +106,7 @@ int main()
106106
}
107107
```
108108
109-
If the default constructor is explicitly declared but marked as deleted, default brace initialization cannot be used:
109+
If the default constructor is explicitly declared but marked as deleted, default brace initialization can't be used:
110110
111111
```cpp
112112
class class_f {

docs/sanitizers/error-stack-buffer-overflow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Error: stack-buffer-overflow"
33
description: "Source examples and live debug screenshots for Stack buffer overflow errors."
4-
ms.date: 03/02/2021
4+
ms.date: 09/28/2021
55
f1_keywords: ["stack-buffer-overflow"]
66
helpviewer_keywords: ["stack-buffer-overflow error", "AddressSanitizer error stack-buffer-overflow"]
77
---
@@ -92,8 +92,8 @@ public:
9292
int main(void) {
9393

9494
Parent p;
95-
Child *c = (Child*)&p; // Boom !
96-
c->extra_field = 42;
95+
Child *c = (Child*)&p;
96+
c->extra_field = 42; // Boom !
9797

9898
return 0;
9999
}

0 commit comments

Comments
 (0)