3 ms·
We're really just telling the compiler to find a file called stdio.h and act as though its contents were included at that part in our program. Whether the full
by avar 6y ago
We're really just telling the compiler to find a file called stdio.h and act as though its contents were included at that part in our program.
Whether the full function is there or linked later is a matter of implementation (some headers have full functions, typically trivial "inline" functions).
I can't remember what the standard says via the stdlib, but in general a library you load later on may not have all/some of those functions, but as long as you didn't use them you'll be fine (just as with a redundant forward declaration you yourself did).
And finally the whole "linking" part of C is mostly just a widespread convention, not something that the standard really dictates. See section 6.2.2 [1] for the brief words on it mainly to do with "static"/"extern". But the whole "compile" -> "link" (to some existing .so/.a) -> "program" is all implementation defined.
1. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
- pjc50 6y agoYes, one of the confusing things for C newbies is the difference between "works this way on almost all implementations you are likely to encounter" and "actually part of the language". Both provide great opportunities for either the compiler or stackexchange answerers to make the newbie feel inadequate.