Re:Unity builds lurked into the Firefox Build System
by flohofwoe on Sunday May 07, 2023 @04:29AM
(#35849181)
> Headers and C style macros are probably the most unfortunate aspects of C (and by extension, C++).
Headers only became a massive problem in C++ because of templates and the unfortunate introduction of the inline keyword.
Typical C headers (including the C stdlib headers) are at most a few hundred lines of function prototypes and struct declarations.
Typical C++ headers on the other hand (include the C++ stdlib headers) contain a mix of declarations and implementation code in template and inline functions and will pull in tens of thousands of lines of code into each compilation unit.
This is also the reason why typical C projects compile orders of magnitude faster than typical C++ projects with a comparable line count and number of source files.
Headers only became a massive problem in C++ because of templates and the unfortunate introduction of the inline keyword.
Typical C headers (including the C stdlib headers) are at most a few hundred lines of function prototypes and struct declarations.
Typical C++ headers on the other hand (include the C++ stdlib headers) contain a mix of declarations and implementation code in template and inline functions and will pull in tens of thousands of lines of code into each compilation unit.
This is also the reason why typical C projects compile orders of magnitude faster than typical C++ projects with a comparable line count and number of source files.