Files
codeql/cpp/ql/src/Metrics/Files/FTransitiveSourceIncludes.qhelp
Chris Smowton 455b840712 Fix all dead qhelp links
For those documents with no obvious new home I've pointed the links to the Internet Archive.
2021-04-23 15:20:21 +01:00

44 lines
1.5 KiB
XML

<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This metric measures the number of files that are directly or indirectly included using
<code>#include</code>, excluding header files which are outside the main source tree (for example, system headers).
</p>
<p>The value of this metric is usually correlated to the file's
build time: the more included files, the longer the compilation time.
Since we don't count system headers, however, it is also a measure of
the amount of the current code base that the present file relies on.</p>
<p>Often, files with a large number of includes do not require most of the included definitions, so
they are contributing to unnecessarily long build times and creating artificial build dependencies.</p>
</overview>
<recommendation>
<ul>
<li>Remove redundant <code>#include</code> directives</li>
<li>Use the specific header file required, if possible, rather than a high-level header that includes many other header files as well</li>
<li>Split header files that contain lots of unrelated definitions or include large unrelated header files</li>
</ul>
</recommendation>
<references>
<li>
<a href="http://www.learncpp.com/cpp-tutorial/19-header-files/">Header files</a>
</li>
<li>
<a href="http://www.drdobbs.com/cpp/decoupling-c-header-files/212701130">Decoupling C Header Files</a>
</li>
<li>
<a href="https://accu.org/journals/overload/14/72/griffiths_1995/">C++ Best Practice -
Designing Header Files</a>
</li>
</references>
</qhelp>