Files
codeql/cpp/ql/src/Critical/InitialisationNotRun.qhelp
2018-08-02 17:53:23 +01:00

28 lines
811 B
XML

<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>The rule finds code that initializes a global variable (i.e. uses it as an L-value) but is never called from <code>main</code>.
Unless there is another entry point that triggers the initialization, the code should be modified so that the variable is initialized.
Uninitialized variables may contain any value, as not all compilers generate code that zero-out memory, especially when
optimizations are enabled or the compiler is not compliant with the latest language standards.
</p>
<include src="callGraphWarning.qhelp" />
</overview>
<recommendation>
<p>Examine the code and ensure that the initialization is always run.</p>
</recommendation>
<example><sample src="InitialisationNotRun.cpp" />
</example>
</qhelp>