|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> Or, look at it a different way, if you're *really* interested in pursuing
> understanding what I'm saying: Why do you #include stdio in your program?
> As you said, it's part of the standard. You can't change it without breaking
> lots of programs. Also, you can't pick a different function to be called
> "printf" without breaking any library that expects "printf" to mean the one
> from stdio. (I.e., C's linker has a flat namespace, so if *anyone* includes
> stdio, then the symbols from stdio will preclude using that name anywhere
> else to mean something different.) So why does one have to recompile
> stdio.h every time you compile a program?
> I know the *technical* reason, as in "because that's how C works." I'm
> asking you to try to understand why working that way is not as good as
> simply telling the compiler you're using the standard library and symbols
> come from there. You see the fact that you're recompiling bits and pieces of
> the standard-mandated standard libraries (that you correctly acknowledge
> can't be changed anyway) every single time you compile your program, yes?
> And that doesn't sound like a strange idea?
Let's take a better example: Every time I want to use std::vector,
I have to #include <vector> in the source file where I want to do so.
Is there any advantage to this?
You could move all standard (non-templated) functions into the core
features of the language rather than them being declared in header files,
and it would still work ok. OTOH, is there a huge disadvantage in having
to include the files other than the trouble of having to write the
#include lines?
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |