[OT] Clang seems to implement modules

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 20 14:45:26 PST 2012


On Tuesday, November 20, 2012 23:32:47 Paulo Pinto wrote:
> Am 20.11.2012 21:57, schrieb Walter Bright:
> > Since people already use precompiled headers with C++, I don't think
> > this change has much chance of making it compile faster.
> 
> Is it really so?
> 
> I would expect that with proper modules C++ compilers could achieve
> compile times similar to what other module based languages offer.
> Specially if templates are also stored in a module friendly format.
> 
> But then again I lack enough compiler development experience to be able
> to judge that.
> 
> Assuming you're right, then C++ is really a lost cause, and the current
> trend of standards might follow what happened to Extended ISO Pascal,
> which vendors ignored in favour of Turbo Pascal as the defacto standard.

You should read this:

http://www.drdobbs.com/cpp/c-compilation-speed/228701711

It's an article by Walter explaining why C++ compilation speeds are so slow. 
Pre-compiled headers would help in some circumstances, but in others, they 
can't (because recompilation is required due to different preprocessor macros 
or whatnot). And there are issues intrinsic to the lanugage which make 
compilation slower even if you were able to compile each file only once. C/C++ 
are just plain badly designed when it comes to compilation speed. Textual 
inclusion is a horrible idea in that regard (though it may have been required 
at the time those languages were created due to the memory constraints of the 
systems at the time).

So, while smart people may be able to make some improvements to C++ to shorten 
compilation times (and we all hope that they succeed), they can never entirely 
fix them. For that, among other things, you'd need a language which didn't use 
textual inclusion, and those sorts of changes would be too big for C/C++ at 
this point. I think that that's on the list of changes which are pointless to 
make to C/C++, because if you were going to break backwards compatibility on 
that level, you might as well just create a new language. The challenge that 
the C/C++ folks have is improving it without breaking backwards compatibility, 
and that's incredibly constraining, since so many of C/C++'s problems are very 
intrinsic to how they're designed.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list