
Header Inclusion 1/4
Merely including headers in source files, even large ones, doesn’t directly increase the
size of the binary. On the other hand, they do affect binary size, depending on their
content and how they are used.
Contribution to the binary size:
• Symbols with internal linkage: each translation unit gets its own copy.
The compiler is able to remove unused symbols (dead code elimitation).
• Inline functions and variables: code generation, inlining, and symbol table.
The linker is able to remove duplicate symbols.
• Templates: contribute in the same way of regular classes, functions, and
variables, but only if they are instantiated.
The linker is able to remove identical template instantiations.
32/38