BartC said:
An unnecessary part. Why can't someone write:
#include <stdheader.h>
or (my preference) write nothing at all, and still be able to use the 1000+
standard functions immediately without this palaver of adding and removing
#include lines?
(And to have it standardised so the code can be shared.)
Because <stdheader.h> doesn't exist and has not been standardized.
When C was first developed, including excessive headers was a big deal;
it could substantially slow down compilation times.
If the committee decided to add it to the standard tomorrow, it would
have no effect on programmers until enough implementers implemented it;
that would mean getting agreement from gcc, Microsoft, lcc{,-win}, and I
don't know how may other providers. And code written to depend on
<stdheader.h> would still fail to compile with older implementations
that don't yet support it (those won't go away any time soon).
It's easy enough to write a <stdheader.h> file (but note that <assert.h>
is a special case), either as part of an implementation or, as a
workaround, as part of a project. But that doesn't necessarily solve
the problem. If I want to compile something that uses <stdheader.h>,
and my system doesn't have it, I might not even have the ability to add
it to the location where the compiler searches for system headers; I
might have to manually edit the source to change <stdheader.h> to
"stdheader.h".
I am *not* aruguing that it's not a good idea, just trying to answer
your question.
I'm personally undecided on the issue, but if it existed I wouldn't
have any strong objection to using it. (One drawback is that,
currently, you can look at the top of a source file and get a
pretty good idea of what parts of the standard library it uses;
combining everything into <stdheader.h> would lose that ability.)
Also, most C code depends on system-specific headers; <stdheader.h>
wouldn't address that.
(And personally, I've never found getting the #include directives
right to be much of a burden.)