Ways of building the code

Programming, for all ages and all languages.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Ways of building the code

Post 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...
Every good solution is obvious once you've found it.
Schol-R-LEA

Re:Ways of building the code

Post 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.
Post Reply