This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: reduce compilation times?
On 2007/11/28, Tom St Denis <tstdenis@ellipticsemi.com> wrote:
> J.C. Pizarro wrote:
> > On 2007/11/28, Duft Markus <Markus.Duft@salomon.at> 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.
It's not false, you get wrong.
> 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.
I'm not sure if GCC C++ does it.
> 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.
We've talking to split files (e.g. 1 file per 1 function or per 1 method),
not to separate tasks or factor tasks.
Java can't split many methods of a class to many files,
only 1 file per 1 class, not 1 file per method.
> 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.
"to maintain" and "to optimize" (reducing time) too.
>
> Tom
>
J.C.Pizarro