Wednesday, March 30, 2011

The Problem With C++


C++ is my bread and butter language, the language I have spent the most time with, and language I know the best.  I've spent a great deal of time learning the ins and outs of C++, and its base language C.

  It is without doubt one of the most complex and powerful programming languages currently available, their isn't much you can't do in C++; procedural, object oriented, functional, meta programming.

  And the recent additions to the language, via C++ 0x, have further boosted its flexibility and power, from the succinct awesomeness of anonymous functions(lambda's) to the performance of R value references.  This is the language of the professionals, and the gaping maw that separates average Joe C++ programmer from the those that really know the language is vast. This is not Java, there has been, and hopefully never will be, any attempt to peddle to the legions of mediocre programmers.


 But despite my love for it, C++ has some serious defects.  Most of them stem from its C heritage.


 And the primary one is compilation times.  The C++ compilation model is archaic, it does exactly what C did, which is to copy and paste the contents of one file into that of another.  As the size of a project grows, the compilation times tend to grow exponentially.  C++ programmers have gone so far as to develop coding styles and even code patterns to reduce compilation types, this helps, but requires much extra time and effort, and in the end all it can really do is reduce the growth to something closer to linear.


 What the C++ committee needs to do is address this issue, and why they haven't already done so is beyond me.  Most modern languages do not take nearly so long to compile, for example D, a language much like C++, actually in many ways superior, but lacking widespread tool & compiler support, uses a more modern import system and avoids the C++ compilation nightmare.

 

No comments:

Post a Comment