Skip to content

Commit f029d33

Browse files
authored
Merge pull request #3998 from MicrosoftDocs/main637914299241972457
Repo sync for protected CLA branch
2 parents 44ee108 + a53a88f commit f029d33

18 files changed

+128
-74
lines changed

docs/code-quality/c6389.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ The rule is an experimental rule that must be explicitly enabled in a rule set f
1919
```cpp
2020
// A.h
2121
struct X;
22-
```
2322

24-
```cpp
2523
// A.cpp
2624
#include "A.h"
2725

@@ -39,9 +37,7 @@ One way to resolve these issues is to move `struct Y` into an anonymous namespac
3937
// A.h
4038
struct X;
4139
void f();
42-
```
4340
44-
```cpp
4541
// A.cpp
4642
#include "A.h"
4743

docs/code-quality/c6390.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: C6390
3+
description: "Describes the Microsoft C/C++ code analysis warning C6390, its causes, and how to address it."
4+
ms.date: 06/17/2022
5+
f1_keywords: ["C6390"]
6+
helpviewer_keywords: ["C6390"]
7+
---
8+
9+
# C6390: NO_NULLCHECK_FOR_THIS
10+
11+
According to the C++ standard, the value of `this` is never null; some compilers will optimize null checks for `this` out. While MSVC is not doing such optimizations, code relying on null-valued `this` can trigger unexpected behavior when compiled with other compilers. This warning helps detect these portability problems.
12+
13+
## Example
14+
15+
```cpp
16+
struct X
17+
{
18+
void m()
19+
{
20+
if(!this) // Warning: According to the C++ standard, the value of 'this' is never null; some compilers will optimize this check out
21+
return;
22+
}
23+
};
24+
```
25+
26+
To solve this problem, rewrite the code to never call non-static member functions on null pointers.

docs/code-quality/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ items:
465465
href: ../code-quality/c6388.md
466466
- name: C6389
467467
href: ../code-quality/c6389.md
468+
- name: C6390
469+
href: ../code-quality/c6390.md
468470
- name: C6400
469471
href: ../code-quality/c6400.md
470472
- name: C6401

docs/data/oledb/user-record.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
22
description: "Learn more about: User Record"
33
title: "User Record"
4-
ms.date: "05/09/2019"
4+
ms.date: 06/21/2022
55
helpviewer_keywords: ["records, user", "OLE DB providers, user record", "user records", "user records, described", "rowsets, user record"]
66
ms.assetid: 9c0d2864-2738-4f62-a750-1016d9c3523f
7+
ms.custom: devdivchpfy22
78
---
9+
810
# User Record
911

1012
> [!NOTE]
@@ -53,7 +55,7 @@ The PROVIDER_COLUMN_MAP macros aid in creating a `GetColumnInfo` function:
5355
5456
- END_PROVIDER_COLUMN_MAP closes the array and the function. It also places the array element count into the *pcCols* parameter.
5557
56-
When a user record is created at run time, `GetColumnInfo` uses the *pThis* parameter to receive a pointer to a rowset or command instance. Commands and rowsets must support the `IColumnsInfo` interface, so column information can be taken from this pointer.
58+
When a user record is created at run time, `GetColumnInfo` uses the *`pThis`* parameter to receive a pointer to a rowset or command instance. Commands and rowsets must support the `IColumnsInfo` interface, so column information can be taken from this pointer.
5759
5860
`CommandClass` and `RowsetClass` are the command and rowset that use the user record.
5961

docs/parallel/amp/reference/index-class.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: index Class"
33
title: "index Class"
4-
ms.date: "03/27/2019"
4+
ms.date: 06/21/2022
55
f1_keywords: ["AMP/index", "AMP/Concurrency::index::index", "AMP/Concurrency::index::rank"]
66
helpviewer_keywords: ["index structure"]
77
ms.assetid: cbe79b08-0ba7-474c-9828-f1a71da39eb3
8+
ms.custom: devdivchpfy22
89
---
10+
911
# index Class
1012

1113
Defines an *N*-dimensional index vector.

docs/standard-library/scoped-allocator-adaptor-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: scoped_allocator_adaptor Class"
33
title: "scoped_allocator_adaptor Class"
4-
ms.date: "11/04/2016"
4+
ms.date: 06/20/2022
55
f1_keywords: ["scoped_allocator/std::scoped_allocator_adaptor", "scoped_allocator/std::scoped_allocator_adaptor::rebind Struct", "scoped_allocator/std::scoped_allocator_adaptor::allocate", "scoped_allocator/std::scoped_allocator_adaptor::construct", "scoped_allocator/std::scoped_allocator_adaptor::deallocate", "scoped_allocator/std::scoped_allocator_adaptor::destroy", "scoped_allocator/std::scoped_allocator_adaptor::inner_allocator", "scoped_allocator/std::scoped_allocator_adaptor::max_size", "scoped_allocator/std::scoped_allocator_adaptor::outer_allocator", "scoped_allocator/std::scoped_allocator_adaptor::select_on_container_copy_construction"]
66
helpviewer_keywords: ["std::scoped_allocator_adaptor", "std::scoped_allocator_adaptor::allocate", "std::scoped_allocator_adaptor::construct", "std::scoped_allocator_adaptor::deallocate", "std::scoped_allocator_adaptor::destroy", "std::scoped_allocator_adaptor::inner_allocator", "std::scoped_allocator_adaptor::max_size", "std::scoped_allocator_adaptor::outer_allocator", "std::scoped_allocator_adaptor::select_on_container_copy_construction"]
77
ms.assetid: 0d9b06a1-9a4a-4669-9470-8805cae48e89
8+
ms.custom: devdivchpfy22
89
---
10+
911
# scoped_allocator_adaptor Class
1012

1113
Represents a nest of allocators.
@@ -21,11 +23,11 @@ class scoped_allocator_adaptor;
2123
2224
The class template encapsulates a nest of one or more allocators. Each such class has an outermost allocator of type `outer_allocator_type`, a synonym for `Outer`, which is a public base of the `scoped_allocator_adaptor` object. `Outer` is used to allocate memory to be used by a container. You can obtain a reference to this allocator base object by calling `outer_allocator`.
2325
24-
The remainder of the nest has type `inner_allocator_type`. An inner allocator is used to allocate memory for elements within a container. You can obtain a reference to the stored object of this type by calling `inner_allocator`. If `Inner...` is not empty, `inner_allocator_type` has type `scoped_allocator_adaptor<Inner...>`, and `inner_allocator` designates a member object. Otherwise, `inner_allocator_type` has type `scoped_allocator_adaptor<Outer>`, and `inner_allocator` designates the entire object.
26+
The remainder of the nest has type `inner_allocator_type`. An inner allocator is used to allocate memory for elements within a container. You can obtain a reference to the stored object of this type by calling `inner_allocator`. If `Inner...` isn't empty, `inner_allocator_type` has type `scoped_allocator_adaptor<Inner...>`, and `inner_allocator` designates a member object. Otherwise, `inner_allocator_type` has type `scoped_allocator_adaptor<Outer>`, and `inner_allocator` designates the entire object.
2527
2628
The nest behaves as if it has arbitrary depth, replicating its innermost encapsulated allocator as needed.
2729
28-
Several concepts that are not a part of the visible interface aid in describing the behavior of this class template. An *outermost allocator* mediates all calls to the construct and destroy methods. It is effectively defined by the recursive function `OUTERMOST(X)`, where `OUTERMOST(X)` is one of the following.
30+
Several concepts that aren't a part of the visible interface aid in describing the behavior of this class template. An *outermost allocator* mediates all calls to the construct and destroy methods. It's effectively defined by the recursive function `OUTERMOST(X)`, where `OUTERMOST(X)` is one of the following.
2931
3032
- If `X.outer_allocator()` is well formed, then `OUTERMOST(X)` is `OUTERMOST(X.outer_allocator())`.
3133

docs/standard-library/shared-future-class.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: shared_future Class"
33
title: "shared_future Class"
4-
ms.date: "11/04/2016"
4+
ms.date: 06/20/2022
55
f1_keywords: ["future/std::shared_future", "future/std::shared_future::shared_future", "future/std::shared_future::get", "future/std::shared_future::valid", "future/std::shared_future::wait", "future/std::shared_future::wait_for", "future/std::shared_future::wait_until"]
66
ms.assetid: 454ebedd-f42b-405f-99a5-a25cc9ad7c90
77
helpviewer_keywords: ["std::shared_future [C++]", "std::shared_future [C++], shared_future", "std::shared_future [C++], get", "std::shared_future [C++], valid", "std::shared_future [C++], wait", "std::shared_future [C++], wait_for", "std::shared_future [C++], wait_until"]
8+
ms.custom: devdivchpfy22
89
---
10+
911
# shared_future Class
1012

1113
Describes an *asynchronous return object*. In contrast with a [future](../standard-library/future-class.md) object, an *asynchronous provider* can be associated with any number of `shared_future` objects.
@@ -19,9 +21,9 @@ class shared_future;
1921

2022
## Remarks
2123

22-
Do not call any methods other than `valid`, `operator=`, and the destructor on a `shared_future` object that's *empty*.
24+
Don't call any methods other than `valid`, `operator=`, and the destructor on a `shared_future` object that's *empty*.
2325

24-
`shared_future` objects are not synchronized. Calling methods on the same object from multiple threads introduces a data race that has unpredictable results.
26+
`shared_future` objects aren't synchronized. Calling methods on the same object from multiple threads introduces a data race that has unpredictable results.
2527

2628
## Members
2729

@@ -36,7 +38,7 @@ Do not call any methods other than `valid`, `operator=`, and the destructor on a
3638
|Name|Description|
3739
|----------|-----------------|
3840
|[get](#get)|Retrieves the result that's stored in the *associated asynchronous state*.|
39-
|[valid](#valid)|Specifies whether the object is not empty.|
41+
|[valid](#valid)|Specifies whether the object isn't empty.|
4042
|[wait](#wait)|Blocks the current thread until the associated asynchronous state is ready.|
4143
|[wait_for](#wait_for)|Blocks until the associated asynchronous state is ready or until the specified time has elapsed.|
4244
|[wait_until](#wait_until)|Blocks until the associated asynchronous state is ready or until a specified point in time.|

docs/standard-library/shared-ptr-class.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: shared_ptr class"
33
title: "shared_ptr class"
4-
ms.date: "07/29/2019"
4+
ms.date: 06/20/2022
55
f1_keywords: ["memory/std::shared_ptr", "memory/std::shared_ptr::element_type", "memory/std::shared_ptr::get", "memory/std::shared_ptr::owner_before", "memory/std::shared_ptr::reset", "memory/std::shared_ptr::swap", "memory/std::shared_ptr::unique", "memory/std::shared_ptr::use_count", "memory/std::shared_ptr::operator boolean-type", "memory/std::shared_ptr::operator*", "memory/std::shared_ptr::operator=", "memory/std::shared_ptr::operator->"]
66
helpviewer_keywords: ["std::shared_ptr [C++]", "std::shared_ptr [C++], element_type", "std::shared_ptr [C++], get", "std::shared_ptr [C++], owner_before", "std::shared_ptr [C++], reset", "std::shared_ptr [C++], swap", "std::shared_ptr [C++], unique", "std::shared_ptr [C++], use_count", "std::shared_ptr [C++], element_type", "std::shared_ptr [C++], get", "std::shared_ptr [C++], owner_before", "std::shared_ptr [C++], reset", "std::shared_ptr [C++], swap", "std::shared_ptr [C++], unique", "std::shared_ptr [C++], use_count"]
77
ms.assetid: 1469fc51-c658-43f1-886c-f4530dd84860
8+
ms.custom: devdivchpfy22
89
---
10+
911
# `shared_ptr` class
1012

1113
Wraps a reference-counted smart pointer around a dynamically allocated object.
@@ -25,7 +27,7 @@ A `shared_ptr` stops owning a resource when it's reassigned or reset.
2527

2628
The template argument `T` might be an incomplete type except as noted for certain member functions.
2729

28-
When a `shared_ptr<T>` object is constructed from a resource pointer of type `G*` or from a `shared_ptr<G>`, the pointer type `G*` must be convertible to `T*`. If it's not convertible, the code will not compile. For example:
30+
When a `shared_ptr<T>` object is constructed from a resource pointer of type `G*` or from a `shared_ptr<G>`, the pointer type `G*` must be convertible to `T*`. If it's not convertible, the code won't compile. For example:
2931

3032
```cpp
3133
#include <memory>
@@ -63,29 +65,29 @@ The `shared_ptr` objects that own a resource share a control block. The control
6365
6466
- the custom allocator for the control block if it has one.
6567
66-
A `shared_ptr` object that is initialized by using a null pointer has a control block and is not empty. After a `shared_ptr` object releases a resource, it no longer owns that resource. After a `weak_ptr` object releases a resource, it no longer points to that resource.
68+
A `shared_ptr` object that is initialized by using a null pointer has a control block and isn't empty. After a `shared_ptr` object releases a resource, it no longer owns that resource. After a `weak_ptr` object releases a resource, it no longer points to that resource.
6769
6870
When the number of `shared_ptr` objects that own a resource becomes zero, the resource is freed, either by deleting it or by passing its address to a deleter, depending on how ownership of the resource was originally created. When the number of `shared_ptr` objects that own a resource is zero, and the number of `weak_ptr` objects that point to that resource is zero, the control block is freed, using the custom allocator for the control block if it has one.
6971
70-
An empty `shared_ptr` object does not own any resources and has no control block.
72+
An empty `shared_ptr` object doesn't own any resources and has no control block.
7173
7274
A deleter is a function object that has a member function `operator()`. Its type must be copy constructible, and its copy constructor and destructor must not throw exceptions. It accepts one parameter, the object to be deleted.
7375
7476
Some functions take an argument list that defines properties of the resulting `shared_ptr<T>` or `weak_ptr<T>` object. You can specify such an argument list in several ways:
7577
76-
no arguments -- the resulting object is an empty `shared_ptr` object or an empty `weak_ptr` object.
78+
no arguments: The resulting object is an empty `shared_ptr` object or an empty `weak_ptr` object.
7779
78-
`ptr` -- a pointer of type `Other*` to the resource to be managed. `T` must be a complete type. If the function fails (because the control block can't be allocated), it evaluates the expression `delete ptr`.
80+
`ptr`: A pointer of type `Other*` to the resource to be managed. `T` must be a complete type. If the function fails (because the control block can't be allocated), it evaluates the expression `delete ptr`.
7981
80-
`ptr, deleter` -- a pointer of type `Other*` to the resource to be managed and a deleter for that resource. If the function fails (because the control block can't be allocated), it calls `deleter(ptr)`, which must be well-defined.
82+
`ptr, deleter`: A pointer of type `Other*` to the resource to be managed and a deleter for that resource. If the function fails (because the control block can't be allocated), it calls `deleter(ptr)`, which must be well-defined.
8183
82-
`ptr, deleter, alloc` -- a pointer of type `Other*` to the resource to be managed, a deleter for that resource, and an allocator to manage any storage that must be allocated and freed. If the function fails (because the control block can't be allocated), it calls `deleter(ptr)`, which must be well-defined.
84+
`ptr, deleter, alloc`: A pointer of type `Other*` to the resource to be managed, a deleter for that resource, and an allocator to manage any storage that must be allocated and freed. If the function fails (because the control block can't be allocated), it calls `deleter(ptr)`, which must be well-defined.
8385
84-
`sp` -- a `shared_ptr<Other>` object that owns the resource to be managed.
86+
`sp`: A `shared_ptr<Other>` object that owns the resource to be managed.
8587
86-
`wp` -- a `weak_ptr<Other>` object that points to the resource to be managed.
88+
`wp`: A `weak_ptr<Other>` object that points to the resource to be managed.
8789
88-
`ap` -- an `auto_ptr<Other>` object that holds a pointer to the resource to be managed. If the function succeeds, it calls `ap.release()`; otherwise it leaves `ap` unchanged.
90+
`ap`: An `auto_ptr<Other>` object that holds a pointer to the resource to be managed. If the function succeeds, it calls `ap.release()`; otherwise it leaves `ap` unchanged.
8991
9092
In all cases, the pointer type `Other*` must be convertible to `T*`.
9193
@@ -162,7 +164,7 @@ element_type* get() const noexcept;
162164

163165
### Remarks
164166

165-
The member function returns the address of the owned resource. If the object does not own a resource, it returns 0.
167+
The member function returns the address of the owned resource. If the object doesn't own a resource, it returns 0.
166168

167169
### Example
168170

@@ -705,7 +707,7 @@ The shared pointer to swap with.
705707
706708
### Remarks
707709
708-
The member function leaves the resource originally owned by **`*this`** subsequently owned by *`sp`*, and the resource originally owned by *`sp`* subsequently owned by **`*this`**. The function does not change the reference counts for the two resources and it does not throw any exceptions.
710+
The member function leaves the resource originally owned by **`*this`** subsequently owned by *`sp`*, and the resource originally owned by *`sp`* subsequently owned by **`*this`**. The function doesn't change the reference counts for the two resources and it doesn't throw any exceptions.
709711
710712
### Example
711713

docs/standard-library/sub-match-class.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
description: "Learn more about: sub_match Class"
33
title: "sub_match Class"
4-
ms.date: "09/10/2018"
4+
ms.date: 06/20/2022
55
f1_keywords: ["regex/std::sub_match", "regex/std::sub_match::matched", "regex/std::sub_match::compare", "regex/std::sub_match::length", "regex/std::sub_match::str", "regex/std::sub_match::difference_type", "regex/std::sub_match::iterator", "regex/std::sub_match::value_type"]
66
helpviewer_keywords: ["std::sub_match [C++]", "std::sub_match [C++], matched", "std::sub_match [C++], compare", "std::sub_match [C++], length", "std::sub_match [C++], str", "std::sub_match [C++], difference_type", "std::sub_match [C++], iterator", "std::sub_match [C++], value_type"]
77
ms.assetid: 804e2b9e-d16a-4c4c-ac60-024e0b2dd0e8
8+
ms.custom: devdivchpfy22
89
---
10+
911
# sub_match Class
1012

1113
Describes a submatch.
@@ -27,7 +29,7 @@ The iterator type for submatches.
2729
2830
The class template describes an object that designates a sequence of characters that matched a capture group in a call to [regex_match](../standard-library/regex-functions.md#regex_match) or to [regex_search](../standard-library/regex-functions.md#regex_search). Objects of type [match_results Class](../standard-library/match-results-class.md) hold an array of these objects, one for each capture group in the regular expression that was used in the search.
2931
30-
If the capture group was not matched the object's data member `matched` holds false, and the two iterators `first` and `second` (inherited from the base `std::pair`) are equal. If the capture group was matched, `matched` holds true, the iterator `first` points to the first character in the target sequence that matched the capture group, and the iterator `second` points one position past the last character in the target sequence that matched the capture group. Note that for a zero-length match the member `matched` holds true, the two iterators will be equal, and both will point to the position of the match.
32+
If the capture group wasn't matched the object's data member `matched` holds false, and the two iterators `first` and `second` (inherited from the base `std::pair`) are equal. If the capture group was matched, `matched` holds true, the iterator `first` points to the first character in the target sequence that matched the capture group, and the iterator `second` points one position past the last character in the target sequence that matched the capture group. For a zero-length match, the member `matched` holds true, the two iterators will be equal, and both will point to the position of the match.
3133
3234
A zero-length match can occur when a capture group consists solely of an assertion, or of a repetition that allows zero repeats. For example:
3335

0 commit comments

Comments
 (0)