Skip to content

Commit 4eb5395

Browse files
authored
Merge pull request #3991 from MicrosoftDocs/main637910839898042237
Repo sync for protected CLA branch
2 parents 729c14f + 23cb929 commit 4eb5395

13 files changed

+115
-74
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4743.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
---
22
description: "Learn more about: Compiler Warning (Level 1) C4743"
33
title: "Compiler Warning (Level 1) C4743"
4-
ms.date: "05/13/2019"
4+
ms.date: 06/16/2022
55
f1_keywords: ["C4743"]
66
helpviewer_keywords: ["C4743"]
77
ms.assetid: 2ee76ea3-77f3-4c2f-9a57-0751823c89fd
88
---
99
# Compiler Warning (Level 1) C4743
1010

11-
'*type*' has different size in '*file1*' and '*file2*': *number* and *number* bytes
11+
> '*type*' has different size in '*file1*' and '*file2*': *size_1* and *size_2* bytes
1212
1313
An external variable referenced or defined in two files has different types in those files, and the compiler determined that the size of the variable in *file1* differs from the size of the variable in *file2*.
1414

1515
## Remarks
1616

17-
There is an important case when this warning can be emitted for C++. If you declare the same types with the same name in two different files, if those declarations contain virtual functions, and if the declarations are not the same, then the compiler can emit warning C4744 for the virtual function tables. The warning occurs because there are two different-sized virtual function tables for the same type, and linker must choose one of them to incorporate into the executable. It is possible that it can result in your program calling the wrong virtual function.
17+
There's an important case when this warning can be emitted for C++. If you declare class types with the same name in two different files, if those declarations contain virtual functions, and if the declarations aren't the same, then the compiler can emit warning C4744 for the virtual function tables. The warning occurs because there are two different-sized virtual function tables for the same type, and the linker must choose one of them to incorporate into the executable. It's possible that it can result in your program calling the wrong virtual function.
1818

1919
To resolve this warning, either use the same type definition or use different names for the types or variables.
2020

2121
## Example
2222

23-
The following sample generates C4743. To compile it, place both files in the same folder, then run
23+
The following sample generates C4743. To compile it, place both files in the same folder, then run this command in a developer command prompt:
2424

2525
```cmd
2626
cl /EHsc /W1 /GL /O2 C4743a.cpp C4743b.cpp
2727
```
2828

29+
Source file *`C4743a.cpp`*:
30+
2931
```cpp
3032
// C4743a.cpp
3133
class C {
@@ -41,6 +43,8 @@ void C::f3(void) {}
4143
C q;
4244
```
4345
46+
Source file *`C4743b.cpp`*:
47+
4448
```cpp
4549
// C4743b.cpp
4650
class C {
@@ -58,3 +62,5 @@ C x;
5862
5963
int main() {}
6064
```
65+
66+
To resolve this issue, rename one of the `C` classes.

docs/standard-library/error-category-class.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: error_category Class"
33
title: "error_category Class"
4-
ms.date: "11/04/2016"
4+
ms.date: 06/15/2022
55
f1_keywords: ["system_error/std::error_category", "system_error/std::error_category::value_type", "system_error/std::error_category::default_error_condition", "system_error/std::error_category::equivalent", "system_error/std::error_category::message", "system_error/std::error_category::name"]
66
helpviewer_keywords: ["std::error_category", "std::error_category::value_type", "std::error_category::default_error_condition", "std::error_category::equivalent", "std::error_category::message", "std::error_category::name"]
77
ms.assetid: e0a71e14-852d-4905-acd6-5f8ed426706d
8+
ms.custom: devdivchpfy22
89
---
10+
911
# error_category Class
1012

1113
Represents the abstract, common base for objects that describes a category of error codes.
@@ -162,7 +164,7 @@ The object to be tested for equality.
162164

163165
#### Return Value
164166

165-
**`true`** if the objects are equal; **`false`** if the objects are not equal.
167+
**`true`** if the objects are equal; **`false`** if the objects aren't equal.
166168

167169
#### Remarks
168170

@@ -183,7 +185,7 @@ The object to be tested for inequality.
183185

184186
#### Return Value
185187

186-
**`true`** if the `error_category` object is not equal to the `error_category` object passed in *right*; otherwise **`false`**.
188+
**`true`** if the `error_category` object isn't equal to the `error_category` object passed in *right*; otherwise **`false`**.
187189

188190
#### Remarks
189191

docs/standard-library/forward-list-class.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
description: "Learn more about: forward_list Class"
33
title: "forward_list Class"
4-
ms.date: "11/04/2016"
4+
ms.date: 06/15/2022
55
f1_keywords: ["forward_list/std::forward_list", "forward_list/std::forward_list::allocator_type", "forward_list/std::forward_list::const_iterator", "forward_list/std::forward_list::const_pointer", "forward_list/std::forward_list::const_reference", "forward_list/std::forward_list::difference_type", "forward_list/std::forward_list::iterator", "forward_list/std::forward_list::pointer", "forward_list/std::forward_list::reference", "forward_list/std::forward_list::size_type", "forward_list/std::forward_list::value_type", "forward_list/std::forward_list::assign", "forward_list/std::forward_list::before_begin", "forward_list/std::forward_list::begin", "forward_list/std::forward_list::cbefore_begin", "forward_list/std::forward_list::cbegin", "forward_list/std::forward_list::cend", "forward_list/std::forward_list::clear", "forward_list/std::forward_list::emplace_after", "forward_list/std::forward_list::emplace_front", "forward_list/std::forward_list::empty", "forward_list/std::forward_list::end", "forward_list/std::forward_list::erase_after", "forward_list/std::forward_list::front", "forward_list/std::forward_list::get_allocator", "forward_list/std::forward_list::insert_after", "forward_list/std::forward_list::max_size", "forward_list/std::forward_list::merge", "forward_list/std::forward_list::pop_front", "forward_list/std::forward_list::push_front", "forward_list/std::forward_list::remove", "forward_list/std::forward_list::remove_if", "forward_list/std::forward_list::resize", "forward_list/std::forward_list::reverse", "forward_list/std::forward_list::sort", "forward_list/std::forward_list::splice_after", "forward_list/std::forward_list::swap", "forward_list/std::forward_list::unique"]
66
helpviewer_keywords: ["std::forward_list", "std::forward_list::allocator_type", "std::forward_list::const_iterator", "std::forward_list::const_pointer", "std::forward_list::const_reference", "std::forward_list::difference_type", "std::forward_list::iterator", "std::forward_list::pointer", "std::forward_list::reference", "std::forward_list::size_type", "std::forward_list::value_type", "std::forward_list::assign", "std::forward_list::before_begin", "std::forward_list::begin", "std::forward_list::cbefore_begin", "std::forward_list::cbegin", "std::forward_list::cend", "std::forward_list::clear", "std::forward_list::emplace_after", "std::forward_list::emplace_front", "std::forward_list::empty", "std::forward_list::end", "std::forward_list::erase_after", "std::forward_list::front", "std::forward_list::get_allocator", "std::forward_list::insert_after", "std::forward_list::max_size", "std::forward_list::merge", "std::forward_list::pop_front", "std::forward_list::push_front", "std::forward_list::remove", "std::forward_list::remove_if", "std::forward_list::resize", "std::forward_list::reverse", "std::forward_list::sort", "std::forward_list::splice_after", "std::forward_list::swap", "std::forward_list::unique"]
7+
ms.custom: devdivchpfy22
78
---
9+
810
# forward_list Class
911

1012
Describes an object that controls a varying-length sequence of elements. The sequence is stored as a singly-linked list of nodes, each containing a member of type `Type`.
@@ -32,7 +34,7 @@ A `forward_list` object allocates and frees storage for the sequence it controls
3234
> [!NOTE]
3335
> The stored allocator object is not copied when the container object is assigned.
3436
35-
Iterators, pointers and references might become invalid when elements of their controlled sequence are erased through `forward_list`. Insertions and splices performed on the controlled sequence through `forward_list` do not invalidate iterators.
37+
Iterators, pointers and references might become invalid when elements of their controlled sequence are erased through `forward_list`. Insertions and splices performed on the controlled sequence through `forward_list` don't invalidate iterators.
3638
3739
Additions to the controlled sequence might occur by calls to [forward_list::insert_after](#insert_after), which is the only member function that calls the constructor `Type(const T&)`. `forward_list` might also call move constructors. If such an expression throws an exception, the container object inserts no new elements and rethrows the exception. Thus, an object of type `forward_list` is left in a known state when such exceptions occur.
3840
@@ -211,9 +213,9 @@ A **`const`** forward-access iterator that points at the first element of the ra
211213

212214
### Remarks
213215

214-
With the return value of `cbegin`, the elements in the range cannot be modified.
216+
With the return value of `cbegin`, the elements in the range can't be modified.
215217

216-
You can use this member function in place of the `begin()` member function to guarantee that the return value is `const_iterator`. Typically, it's used in conjunction with the [auto](../cpp/auto-cpp.md) type deduction keyword, as shown in the following example. In the example, consider `Container` to be a modifiable (non- **`const`**) container of any kind that supports `begin()` and `cbegin()`.
218+
You can use this member function in place of the `begin()` member function to guarantee that the return value is `const_iterator`. Typically, it's used with the [auto](../cpp/auto-cpp.md) type deduction keyword, as shown in the following example. In the example, consider `Container` to be a modifiable (non- **`const`**) container of any kind that supports `begin()` and `cbegin()`.
217219

218220
```cpp
219221
auto i1 = Container.begin();
@@ -238,7 +240,7 @@ A forward-access iterator that points just beyond the end of the range.
238240

239241
`cend` is used to test whether an iterator has passed the end of its range.
240242

241-
You can use this member function in place of the `end()` member function to guarantee that the return value is `const_iterator`. Typically, it's used in conjunction with the [auto](../cpp/auto-cpp.md) type deduction keyword, as shown in the following example. In the example, consider `Container` to be a modifiable (non- **`const`**) container of any kind that supports `end()` and `cend()`.
243+
You can use this member function in place of the `end()` member function to guarantee that the return value is `const_iterator`. Typically, it's used with the [auto](../cpp/auto-cpp.md) type deduction keyword, as shown in the following example. In the example, consider `Container` to be a modifiable (non- **`const`**) container of any kind that supports `end()` and `cend()`.
242244

243245
```cpp
244246
auto i1 = Container.end();
@@ -248,7 +250,7 @@ auto i2 = Container.cend();
248250
// i2 is Container<T>::const_iterator
249251
```
250252

251-
The value returned by `cend` should not be dereferenced.
253+
The value returned by `cend` shouldn't be dereferenced.
252254

253255
## <a name="clear"></a> clear
254256

@@ -272,7 +274,7 @@ typedef implementation-defined const_iterator;
272274

273275
### Remarks
274276

275-
`const_iterator` describes an object that can serve as a constant forward iterator for the controlled sequence. It is described here as a synonym for an implementation-defined type.
277+
`const_iterator` describes an object that can serve as a constant forward iterator for the controlled sequence. It's described here as a synonym for an implementation-defined type.
276278

277279
## <a name="const_pointer"></a> const_pointer
278280

@@ -457,7 +459,7 @@ The initializer_list to copy.
457459

458460
### Remarks
459461

460-
All constructors store an [allocator](../standard-library/allocator-class.md) and initialize the controlled sequence. The allocator object is the argument *Al*, if present. For the copy constructor, it is `right.get_allocator()`. Otherwise, it is `Allocator()`.
462+
All constructors store an [allocator](../standard-library/allocator-class.md) and initialize the controlled sequence. The allocator object is the argument *Al*, if present. For the copy constructor, it's `right.get_allocator()`. Otherwise, it's `Allocator()`.
461463

462464
The first two constructors specify an empty initial controlled sequence.
463465

@@ -561,7 +563,7 @@ typedef implementation-defined iterator;
561563

562564
### Remarks
563565

564-
`iterator` describes an object that can serve as a forward iterator for the controlled sequence. It is described here as a synonym for an implementation-defined type.
566+
`iterator` describes an object that can serve as a forward iterator for the controlled sequence. It's described here as a synonym for an implementation-defined type.
565567

566568
## <a name="max_size"></a> max_size
567569

@@ -926,7 +928,7 @@ The forward list providing the elements to be exchanged.
926928
927929
### Remarks
928930
929-
The member function swaps the controlled sequences between **`*this`** and *right*. If `get_allocator() == right.get_allocator()`, it does so in constant time, it throws no exceptions, and it invalidates no references, pointers, or iterators that designate elements in the two controlled sequences. Otherwise, it performs a number of element assignments and constructor calls proportional to the number of elements in the two controlled sequences.
931+
The member function swaps the controlled sequences between **`*this`** and *right*. If `get_allocator() == right.get_allocator()`, it does so in constant time, it throws no exceptions, and it invalidates no references, pointers, or iterators that designate elements in the two controlled sequences. Otherwise, it performs element assignments and constructor calls proportional to the number of elements in the two controlled sequences.
930932
931933
## <a name="unique"></a> unique
932934

docs/standard-library/fpos-class.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: fpos Class"
33
title: "fpos Class"
4-
ms.date: "03/27/2019"
4+
ms.date: 06/15/2022
55
f1_keywords: ["iosfwd/std::fpos", "iosfwd/std::fpos::seekpos", "iosfwd/std::fpos::state", "iosfwd/std::fpos::operator streamoff"]
66
helpviewer_keywords: ["std::fpos [C++]", "std::fpos [C++], seekpos", "std::fpos [C++], state"]
77
ms.assetid: ffd0827c-fa34-47f4-b10e-5cb707fcde47
8+
ms.custom: devdivchpfy22
89
---
10+
911
# fpos Class
1012

1113
The class template describes an object that can store all the information needed to restore an arbitrary file-position indicator within any stream. An object of class fpos\< **St**> effectively stores at least two member objects:
@@ -38,7 +40,7 @@ State information.
3840
3941
|Member function|Description|
4042
|-|-|
41-
|[seekpos](#seekpos)|Used internally by the C++ Standard Library only. Do not call this method from your code.|
43+
|[seekpos](#seekpos)|Used internally by the C++ Standard Library only. Don't call this method from your code.|
4244
|[state](#state)|Sets or returns the conversion state.|
4345
4446
### Operators
@@ -82,7 +84,7 @@ The offset into the stream.
8284

8385
### Remarks
8486

85-
The first constructor stores the offset *_Off*, relative to the beginning of file and in the initial conversion state (if that matters). If *_Off* is -1, the resulting object represents an invalid stream position.
87+
The first constructor stores the offset *_Off*, relative to the beginning of file and in the initial conversion state. If *_Off* is -1, the resulting object represents an invalid stream position.
8688

8789
The second constructor stores a zero offset and the object *_State*.
8890

@@ -101,7 +103,7 @@ The file-position indicator against which to compare.
101103

102104
### Return Value
103105

104-
**`true`** if the file-position indicators are not equal, otherwise **`false`**.
106+
**`true`** if the file-position indicators aren't equal, otherwise **`false`**.
105107

106108
### Remarks
107109

@@ -178,7 +180,7 @@ The position in the file.
178180

179181
### Remarks
180182

181-
The member function returns **fpos(\*this) +=** `_Off`.
183+
The member function returns **`fpos(*this) +=_Off`**.
182184

183185
### Example
184186

@@ -203,7 +205,7 @@ The position in the file.
203205

204206
### Remarks
205207

206-
The member function adds *_Off* to the stored offset member object and then returns **\*this**. For positioning within a file, the result is generally valid only for binary streams that do not have a state-dependent encoding.
208+
The member function adds *_Off* to the stored offset member object and then returns **`*this`**. When working with files, the result is valid only for binary streams that don't have a state-dependent encoding.
207209

208210
### Example
209211

@@ -254,7 +256,7 @@ The member function returns `fpos(*this) -= _Off`.
254256

255257
### Remarks
256258

257-
For positioning within a file, the result is generally valid only for binary streams that do not have a state-dependent encoding.
259+
When working with files, the result is valid only for binary streams that don't have a state-dependent encoding.
258260

259261
### Example
260262

@@ -326,7 +328,7 @@ int main( )
326328

327329
## <a name="seekpos"></a> fpos::seekpos
328330

329-
This method is used internally by the C++ Standard Library only. Do not call this method from your code.
331+
This method is used internally by the C++ Standard Library only. Don't call this method from your code.
330332

331333
```cpp
332334
fpos_t seekpos() const;

docs/standard-library/front-insert-iterator-class.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
---
22
description: "Learn more about: front_insert_iterator Class"
33
title: "front_insert_iterator Class"
4-
ms.date: "11/04/2016"
4+
ms.date: 06/15/2022
55
f1_keywords: ["iterator/std::front_insert_iterator", "iterator/std::front_insert_iterator::container_type", "iterator/std::front_insert_iterator::reference"]
66
helpviewer_keywords: ["std::front_insert_iterator [C++]", "std::front_insert_iterator [C++], container_type", "std::front_insert_iterator [C++], reference"]
77
ms.assetid: a9a9c075-136a-4419-928b-c4871afa033c
8+
ms.custom: devdivchpfy22
89
---
10+
911
# front_insert_iterator Class
1012

11-
Describes an iterator adaptor that satisfies the requirements of an output iterator. It inserts, rather than overwrites, elements into the front of a sequence and thus provides semantics that are different from the overwrite semantics provided by the iterators of the C++ sequence containers. The `front_insert_iterator` class is templatized on the type of container.
13+
Describes an iterator adaptor that satisfies the requirements of an output iterator. It inserts, rather than overwrites, elements into the front of a sequence. Thus it provides semantics that are different from the overwrite semantics provided by the iterators of the C++ sequence containers. The `front_insert_iterator` class is templatized on the type of container.
1214

1315
## Syntax
1416

@@ -24,7 +26,7 @@ The type of container into the front of which elements are to be inserted by a `
2426

2527
## Remarks
2628

27-
The container must satisfy the requirements for a front insertion sequence where is it possible to insert elements at the beginning of the sequence in amortized constant time. The C++ Standard Library sequence containers defined by the [deque Class](../standard-library/deque-class.md) and [list Class](../standard-library/list-class.md) provide the needed `push_front` member function and satisfy these requirements. By contrast, sequence containers defined by the [vector Class](../standard-library/vector-class.md) do not satisfy these requirements and cannot be adapted to use with `front_insert_iterator`s. A `front_insert_iterator` must always be initialized with its container.
29+
The container must satisfy the requirements for a front insertion sequence where is it possible to insert elements at the beginning of the sequence in amortized constant time. The C++ Standard Library sequence containers defined by the [deque Class](../standard-library/deque-class.md) and [list Class](../standard-library/list-class.md) provide the needed `push_front` member function and satisfy these requirements. By contrast, sequence containers defined by the [vector Class](../standard-library/vector-class.md) don't satisfy these requirements and can't be adapted to use with `front_insert_iterator`s. A `front_insert_iterator` must always be initialized with its container.
2830

2931
### Constructors
3032

@@ -172,7 +174,7 @@ The member function returns the value of the element addressed.
172174

173175
### Remarks
174176

175-
Used to implement the output iterator expression **\*Iter** = **value**. If `Iter` is an iterator that addresses an element in a sequence, then **\*Iter** = **value** replaces that element with value and does not change the total number of elements in the sequence.
177+
Used to implement the output iterator expression **\*Iter** = **value**. If `Iter` is an iterator that addresses an element in a sequence, then **\*Iter** = **value** replaces that element with value and doesn't change the total number of elements in the sequence.
176178

177179
### Example
178180

0 commit comments

Comments
 (0)