A global or state variable was declared with no initial value and used without an earlier assignment.
The C/C++ language guarantees that variables declared without any initial value are initialized to zero and many applications rely on this behavior. However, from a style point of view, the fact that a variable has no explicit initial value could indicate that the proper initialization was omitted by mistake. Therefore, it is preferable to specify an explicit initialization to zero to clarify that this is the author's intent. This warning diagnostic flags the first read of a variable if that variable was not previously assigned and there is no explicit initial value.
ID |
Observation |
Description |
---|---|---|
1 |
Memory read |
The place the variable was first read |
int x; // default initialized to zero int main(int argc, char **argv) { return x; // reads value provided by default initialization }
Copyright © 2010, Intel Corporation. All rights reserved.