Skip to content

Commit 97d5393

Browse files
authored
Update c26430.md
Made some fixes that would have showed up on acrolinx, and simplified the language a little.
1 parent b035e9c commit 97d5393

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/code-quality/c26430.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ void merge_states(gsl::not_null<const state *> left, gsl::not_null<const state *
6868

6969
## Heuristics
7070

71-
The rule does not enforce every dereference of a pointer to have a prior null check to ensure the pointer is not null. Instead, it requires a null check before first derefernce of the pointer. So, the following function does not trigger a C26430 warning:
71+
This rule doesn't enforce every dereference of a pointer to have a prior null check to ensure the pointer isn't. Instead, it requires a null check before first dereference of the pointer. The following function doesn't trigger C26430:
72+
7273
```cpp
7374
void f(int* p)
7475
{
@@ -77,7 +78,9 @@ void f(int* p)
7778
*p = 2;
7879
}
7980
```
80-
But the following function gets a C26430 warning because there is a path without null check for p to where *p is assigned with 2:
81+
82+
The following function generates C26430 because there's a path to assign `*p` without a null check:
83+
8184
```cpp
8285
void f(bool b, int* p)
8386
{
@@ -86,11 +89,12 @@ void f(bool b, int* p)
8689
*p = 2;
8790
}
8891
```
92+
8993
Rules [C26822](c26822.md) and [C26823](c26823.md) apply to dereferencing a (possibly) null pointer.
9094

91-
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).
95+
This 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.
9296

9397
## See also
9498

9599
[C26822](c26822.md)\
96-
[C26823](c26823.md)
100+
[C26823](c26823.md)

0 commit comments

Comments
 (0)