Skip to content

Commit 7166046

Browse files
TylerMSFTTylerMSFT
authored andcommitted
edits
1 parent 97d8538 commit 7166046

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

docs/code-quality/c6001.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ title: Warning C6001
44
ms.date: 10/04/2022
55
f1_keywords: ["C6001", "USING_UNINIT_VAR", "__WARNING_USING_UNINIT_VAR"]
66
helpviewer_keywords: ["C6001"]
7-
ms.assetid: 55e779f1-7295-48f7-8ce1-b43898b36cd8
87
---
98
# Warning C6001
109

@@ -18,7 +17,7 @@ Code analysis name: `USING_UNINIT_VAR`
1817

1918
## Example
2019

21-
The following code generates this warning because variable `i` is only initialized if `b` is true; otherwise an uninitialized `i` is returned:
20+
The following code generates this warning because variable `i` is only initialized if `b` is true:
2221

2322
```cpp
2423
int f( bool b )
@@ -49,7 +48,7 @@ int f( bool b )
4948

5049
## Heuristics
5150

52-
Variables are considered initialized when they're passed by reference to another function. The following example shows that `i` is assumed to be initialized by the function it's passed to.
51+
A variable is considered initialized if it's passed to a function by reference, as shown in the following example:
5352

5453
```cpp
5554
void init( int& i );
@@ -64,7 +63,7 @@ int f( bool b )
6463
{
6564
i = 0;
6665
}
67-
return i; // i is assumed to be initialized by init(i)
66+
return i; // i is assumed to be initialized because it's passed by reference to init()
6867
}
6968
```
7069

0 commit comments

Comments
 (0)