Stephen Sprunk said:
It's still enough of an issue today that, even with fast machines,
many compilers support have to pre-compiled headers to keep build
times down.
It's my impression that this is mainly for the benefit of C++, where, on
account of templates, inline functions, etc, there can be a significant
amount of complex code in headers. As far as C, I think that system
headers, GUI toolkits, and headers specific to the project contribute a
lot more to build time than the ISO standard headers.
For comparison, I tried preprocessing tiny programs that #include
various headers and counting the number of nonblank lines in the output
not starting with "#" (to exclude line markers left by the
preprocessor).
The 24 ISO C headers: 1216 lines
The X11 headers included by the "xlogo" example program: 6604 lines
The 32 standard C++ headers (per Wikipedia): 30764 lines
<QtGui> only: 59406 lines
I don't think the effect of merging all the standard C headers into one
would be significant performance-wise these days.
On most systems, depending on how the linking is done, any global
identifier defined by any part of a library will be unavailable for a
program's use, even if the program does not include the header where
that identifier is declared, and in some cases even if the identifier in
question is not referenced by the program nor the portion of the library
that it does use. So splitting up a library's headers doesn't really
address this issue either. Of course, it does help with macro
proliferation.