C++
C++ : an octopus made by nailing extra legs onto a dog.
-- off smalltalk.org
Think of C++ as an object-oriented assembly language.
-- off the guile Scheme mailing list
C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, you blow your whole leg off.
-- Bjarne Stroustrup
Programming in C++ is premature optimization.
-- off comp.lang.python
C++ adds object-oriented and generic programming features to C, along with a host of other features. This can significantly improve the abstraction level of C++ programs relative to C programs, and this should make the language more scalable. Unfortunately, the presence of pointers and the absence of GC, in my opinion, undoes all the benefits of the useful features and makes C++ non-scalable (for instance, NONE of the standard template library (STL) container classes use GC). In addition, C++ is so mind-bogglingly complex, with so many odd features that interact in peculiar ways, that it's almost impossible to master. I will readily admit that I'd rather write a large application in C++ than in C, but that's like saying I'd rather eat rotting meat than swallow sulfuric acid ;-)
To be fair, I have to point out that there is some really neat stuff possible in C++ using templates (typically lumped under the name "template metaprogramming"; see the book Modern C++ Design by Andrei Alexandrescu for more information.). This is very much wizard-level programming (which is OK), but to my mind it doesn't even come close to compensating for the lack of GC. What would make C++ a more scalable language is (a) including a garbage collector as part of the standard library, and (b) having some way to restrict the use of pointers to particular modules that need direct pointer access (such as very low-level data structures). I'm not very optimistic that this will ever happen, but I hope it does.
No comments:
Post a Comment