C++ is Broken

Published on July 11, 2005

I do a fair amount of C++ programming these days, thanks to my new career at IBM. C++ is my strongest language, and the first language I picked up when I began programming. As such, it’s fairly special to me. However, the more I time I spend with C++, the more I come to see how broken it is.

For instance, why are strings not a base type? Character arrays simply do not suffice. I am aware of the STL string class (and I make use of it), but adding on this capability after the fact seems cheap. Strings should be a first-class object, and should have all the associated operators directly available (==, +=, etc.). And regular expressions should be directly available for strings, since they are so incredibly useful. There are tons of places in my code where access to regular expressions would make my life profoundly simple. For example, take Perl’s match operator (m//). How many Perl programs out there do not make use of this operator? My guess is that the number is very low. It’s no different in C++; reg-exes could be used all over the place.

Other glaring omissions also crop up. Where is the foreach loop construct? Why use #include instead of packages or modules? Where are the array operators (shift, unshift, pop, push)?

There’s no question that C++ is a robust language. It’s fast, gives the programmer complete control (both a blessing and a curse), and it has an incredible user base (which results in excellent support when you need it). But it’s clearly dated. Will we still hold on to this language in 20 years? Or will something innovative finally come along to push it aside? Let’s hope for the latter.

Comments are closed.

Copyright © 2004-2019 Jonah Bishop. Hosted by DreamHost.