|
![](/i/fill.gif) |
Warp wrote:
> 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?
For C++ and templates, yes. Altho (and I know you'll go apeshit over this
comment) C# manages not to need the source code for generics like that.
The problem is, again, that it can be abused. It works great as long as you
put templates and declarations and such in there, and as long as you don't
build entire type systems and programming structures and such via macros[*].
It sucks when someone starts using include files that are order-dependent,
that try to enforce coding conventions, that screw up the syntax of the
language you're coding in, etc. None of which is possible if you're not
including someone else's source code into your own compilation.
> OTOH, is there a huge disadvantage in having
> to include the files other than the trouble of having to write the
> #include lines?
Yes. And I had an entire 50-line post detailing the logical disadvantages of
it. Basically, it discussed the benefits of having every source file
actually generate object code. Perhaps you missed it?
[*] And please think about it for a bit before accusing me of moving the
goalposts to include macros, eh? Try to do the "why would he bring up that
topic" question before just assuming I must be doing it to annoy you or
something.
--
Darren New, San Diego CA, USA (PST)
"How did he die?" "He got shot in the hand."
"That was fatal?"
"He was holding a live grenade at the time."
Post a reply to this message
|
![](/i/fill.gif) |