You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
22
21
23
22
```cpp
24
23
intf( bool b )
@@ -49,7 +48,7 @@ int f( bool b )
49
48
50
49
## Heuristics
51
50
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:
53
52
54
53
```cpp
55
54
voidinit( int& i );
@@ -64,7 +63,7 @@ int f( bool b )
64
63
{
65
64
i = 0;
66
65
}
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()
0 commit comments