C++ was a child of its time

I posted this as a comment to "Never trust a programmer who says he knows C++" and figured I'd post it on my blog as well.

There is a kind of symmetry to the incremental teaching of C++, from “C with classes” to the whole “modern C++”: it was invented that way and inflicted upon the world that way. Consequently C++ exists in all its intermediate forms in the wild. C++ apologists tend to not want to talk about what this really means.

As an experimental language it did have some value; in much the same manner that experiments with eating the wrong sort of mushroom has value — unless you are the test-subject. You learn what not to ingest. This frankensteinian mishmash should have stayed in the lab. Unfortunately, at the time this pathogen seeped under the door and out into the world, it was just too tempting to make use of it. It offered familiarity and performance.

We have better computers now. We also have a much broader palette of good languages that can more clearly express intent. We have also become slightly better at building systems that make use of several languages to allow us to solve problems with languages that are better suited for the problem domain at hand.

The generation of programmers that matured in the 00s are both more fortunate and far more aware of the rich fauna of programming languages and more pragmatic approaches than the generations that matured in the decades before. It is not uncommon to encounter developers who are proficient in at least half a dozen languages and who have some knowledge of at least a dozen or so proper programming languages.

Most proponents of “modern C++” are, I’m afraid, still on the wrong side of the valley. Much of what is claimed about how it is perfectly possible to write clear, performant and simple C++ does not take into account that while this may be true for smaller systems that have been implemented from scratch, it is somewhere between myth and fiction in the harsh reality of systems with legacy code or even modest integration requirements.

With C++ things invariably get ugly. Very ugly.

I have yet to meet a “C++ purist” who can look me in the eye and tell me that he or she has not had to resort compromise his or her code as wishful thinking gets its nose bloodied on harsh reality. I have met plenty of people who consider themselves competent C++ hackers who are, at best the software engineering equivalent of drunk drivers.


  1. Always a pleasure to hear you rant about C++ Bjørn :-)

  2. (wrote a whole diatribe, then deleted it, done this too many times before ;-) )

    But spending months in a language without proper RAII, really makes me miss C++. GC is just a bug.

  3. Øystein: I would have loved to read it. :-)

    There are uses for C++. In particular in systems that have stringent timing requirements or very tight resource constraints. But very, very few programmers work on those types of systems.

    Most software would benefit more from correctness and from proper design that from being able to do the bookkeeping yourself.