Skip to content

Commit 3cdf451

Browse files
Merge pull request #5061 from MicrosoftDocs/main638551066469283099sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 00dc68d + 2e827c4 commit 3cdf451

File tree

5 files changed

+231
-197
lines changed

5 files changed

+231
-197
lines changed

.whatsnew.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://whatsnewapi.azurewebsites.net/schema",
2+
"$schema": "https://github.com/dotnet/docs-tools/blob/main/WhatsNew.Infrastructure/Configuration/reposettings.schema.json",
33
"docSetProductName": "C++, C, and Assembler",
44
"rootDirectory": "docs/",
55
"docLinkSettings": {
@@ -10,7 +10,8 @@
1010
"minAdditionsToFile": 2,
1111
"pullRequestTitlesToIgnore": [
1212
"^Confirm merge from FromPublicMasterBranch",
13-
"^Repo sync for protected CLA branch"
13+
"^Repo sync for protected CLA branch",
14+
"^Repo sync for protected branch"
1415
],
1516
"omitPullRequestTitles": false
1617
},

docs/code-quality/c26430.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ A variable is marked as checked for null when it's used in the following context
2727
- in non-bitwise logical operations;
2828
- in comparison operations where one operand is a constant expression that evaluates to zero.
2929

30-
The rule doesn't have full data flow tracking. It can produce incorrect results in cases where indirect checks are used (such as when an intermediate variable holds a null value and is later used in a comparison).
31-
3230
Implicit null checks are assumed when a pointer value is assigned from:
3331

3432
- an allocation performed with throwing `operator new`;
@@ -67,3 +65,36 @@ void merge_states(gsl::not_null<const state *> left, gsl::not_null<const state *
6765
}
6866
}
6967
```
68+
69+
## Heuristics
70+
71+
When ensuring that a dereference of a pointer isn't null, this rule doesn't require *every* dereference to have a prior null check. Instead, it requires a null check before *first* dereference of the pointer. The following function doesn't trigger C26430:
72+
73+
```cpp
74+
void f(int* p)
75+
{
76+
if (p)
77+
*p = 1;
78+
*p = 2;
79+
}
80+
```
81+
82+
The following function generates C26430 because there's a path to assign `*p` without a null check:
83+
84+
```cpp
85+
void f(bool b, int* p)
86+
{
87+
if (b && p)
88+
*p = 1;
89+
*p = 2;
90+
}
91+
```
92+
93+
Rules [C26822](c26822.md) and [C26823](c26823.md) apply to dereferencing a (possibly) null pointer.
94+
95+
This rule doesn't do full data flow tracking. It can produce incorrect results in cases where indirect checks are used, such as when an intermediate variable holds a null value and is later used in a comparison.
96+
97+
## See also
98+
99+
[C26822](c26822.md)\
100+
[C26823](c26823.md)

docs/error-messages/compiler-errors-1/compiler-error-c2217.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ ms.assetid: 1ce1e3f5-4171-4376-804d-967f7e612935
1212

1313
The first function attribute requires the second attribute.
1414

15-
### To fix by checking the following possible causes
16-
17-
1. Interrupt (`__interrupt`) function declared as `near`. Interrupt functions must be `far`.
18-
19-
1. Interrupt function declared with **`__stdcall`**, or **`__fastcall`**. Interrupt functions must use C calling conventions.
20-
2115
## Example
2216

23-
C2217 can also occur if you attempt to bind a delegate to a CLR function that takes a variable number of arguments. If the function also has e param array overload, use that instead. The following sample generates C2217.
17+
C2217 can occur if you attempt to bind a delegate to a CLR function that takes a variable number of arguments. If the function also has a param array overload, use that instead. The following sample generates C2217.
2418

2519
```cpp
2620
// C2217.cpp

0 commit comments

Comments
 (0)