Kenneth Brody said:
And which programming languages do not require that you look up how to use
a feature when you can't remember how it works?
This is nothing to do with how to use a feature. There're plenty of C
runtime functions that I know perfectly well how to use, but can never
remember exactly which header is needed.
Or I'm adding a bit of code, say using strlen(), and it says "no prototype
for strlen()" or something. it interrupts my concentration.
Or I'm pasting a fragment of code from elsewhere, which uses standard
library features that need a header not yet added to this module. In that
case I don't need or want to know how the feature works, but am forced to
look it up, or try and guess from the other module's list of includes, which
one might be pertinent.
Or I'm removing a piece of code, and I have to maintain, in my mind, a count
of how many references there are to the contents of each header. When the
reference count reaches 0, I have to remove that header.
Leaving it in is usually harmless, but in that case, why not just declare
everything anyway? I'm not too familiar with other languages, other than my
own, but I'd say that basic built-in stuff does not need declaring (by
mechanisms such as include and import) as much as it does in C.
(My own C-like language, it does use one header that declares all the basic
stuff, but the header is automatically included by the compilation process,
so never needs to included explicity in the module.)
So like I said, it's an annoyance than an all-inclusive header file is not
standardised.