Page 3 of 3

Re:Ways of building the code

Posted: Wed Oct 26, 2005 5:21 am
by Solar
OSMAN wrote: And what I have against #includes is that always I create a new source file I should write an #include for it to some other file, and so on.
Ohhhh....kayyyyyy....

The thing being, you don't have to... but that would mean explaining modular programming to you, when you're pretty set in your ways and not really interested in doing it a different way...

Re:Ways of building the code

Posted: Wed Oct 26, 2005 4:54 pm
by Schol-R-LEA
No offense, OSMAN, but this actually will end up being more work than what you are trying to avoid, in the long run. Also, it is less efficient - the whole program needs to be re-compiled each time, rather than just those source files which have been touched - and more error prone. Realistically, while there's a certain cleverness to it, this is even more of a kludge than [tt]#include[/tt]s themselves.

With [tt]#include[/tt]s, the information about dependencies is localized; only those headers which the source file specifically requires gets included for a given compilation. Also, having the inclusion information in the source file rather than the makefile makes it easier to re-use a library - several different programs can [tt]#include[/tt] and link in the same object file automatically. Furthermore, you would need a C header to prototype functions written in other languages - and in systems programming, you can't really avoid some assembly code, and inline code won't cut it much of the time.