1 |
On Saturday 13 May 2006 11:41, Duncan wrote: |
2 |
> Of course, making all this worse is the fact that g++ works much harder |
3 |
> to compile C++ than gcc has to, to compile C. That's because it takes |
4 |
> fewer lines in C++ to program the same stuff, yet g++ compiles it to |
5 |
> code of roughly the same performance. If 10 lines of C++ does the same |
6 |
> as 20 lines of C, resulting in native binary code of the same |
7 |
> efficiency, then g++ will have to work twice as hard to do it as the C |
8 |
> compiler part of gcc. That's why C++ based packages require so much |
9 |
> more memory and time for gcc/g++ to compile than C based packages. The |
10 |
> tradeoff is basically that it's easier to program in C++, making the |
11 |
> programmer more efficient, at the expense of making the compiler do all |
12 |
> the work that the programmer was able to skip. |
13 |
|
14 |
Actually this is only one part of the problem. Another part is caused by |
15 |
the fact that in general C++ programs (specially the kde/qt ones) include |
16 |
megabytes of header files. For much things it is needed to have the whole |
17 |
inheritance tree of many objects imported into a C++ file. In C this is |
18 |
much less an issue, and average preprocessed source is much smaller. In |
19 |
general bigger source leads to bigger compile times. In general the lack |
20 |
of a proper module system (like pascal has) is a serious deficiency in |
21 |
both C and C++ (even more). (This is for compilers, analyzers, and |
22 |
authors (Writing things twice)). |
23 |
|
24 |
Paul |
25 |
|
26 |
-- |
27 |
Paul de Vrieze |
28 |
Gentoo Developer |
29 |
Mail: pauldv@g.o |
30 |
Homepage: http://www.devrieze.net |