J.C. Pizarro wrote:
On 2007/11/28, Duft Markus <Markus.Duft@xxxxxxxxxx> wrote:
Hi!
I assume, that all strategies discussed here are targeted at C. now what
about C++, how do things behave there? As far as i know C++ is much
different, and requires completely different thinking with regards to
splitting source in more files, etc.
Cheers, Markus
Your comment is good.
Splitting C files is different to splitting C++ files or splitting Java files,
Fortran, Ada, ObjC, ....
As GCC is made in C-only then we only need to split C files to reduce the
recompilation time if we want.
For other projects made in C++, Java, Fortran, Ada, ObjC, ...., they are
hard to split their files.
This is so blatantly false ... I don't know about fortran/ada/obj, but
for C++ and Java you can trivially factor your code.
In the case of C++, you can just put each method of a class in a
separate .C file. Provided they all include a .H file which defines the
class prototype it's ok.
In the case of Java, you can break up a large task into classes which
handle separate functions of the program. For example, a compiler may
have an I/O class, a lexer class, a parser class, an interface for
optimizations, and various implementations of the interface, etc, etc.
Hell, most colleges teach things like the MVC model when doing GUI Java
apps which, last I checked, is a way to refactor one large program into
separate tasks.
And again you're missing the point (with your comment about future GCCs
that I accidentally snipped). You want to refactor your code so you can
***MAINTAIN*** it.
Tom