My Beef with C++

Bjarne Stroustrup is giving two speeches in Finland this week. Stroustrup’s topic is the trends and future of C++. I have been seriously contemplating protesting his speeches. I have thinking about what kind of signs should I make for the event. (These are all jokes, of course, I am not actually going to do this)

“Thanks Bjarne, for ruining the lives of millions of coders”

“Because of you, Bjarne, I hate my job”

“I hope C++ dies as soon as possible”

“You look almost as ugly as C++”

“What where you using, when C++ was designed?”

“Seriously, was that [C++] the best you could come up with?”

Anyway, I have a serious beef with C++. The more I have to use the more I despise it. Biggest problem is that everyone has their own idea of what C++ should be. So basically one code base could be using 15 different programming languages, except they are all called C++.

Don’t try to sell me the crap that you can write bad code in any language. That is true, but no other language, which I know of, allows you to write so complex stuff in so many different ways that it requires multiple PhDs to understand what is happening. Bad programmers will write bad code in any language, but at least I might understand it. I have been coding C++ (or C with classes) for too long and I am still baffled every time I see templates mixed with operator overloading.

Why do people have the need to do complex things, when a simple solution would do the job? Are they trying to prove their superiority as C++ coders? Maybe they are making themselves irreplaceable, because no one else will understand their code. “He must be good coder, because no else will understand his code”. I think that is bullshit. Good coder is someone who writes code that others can follow easily. I don’t respect people who write so complicated code that my head starts to hurt when I see the code.

There are way too many features in C++. You can get a decent language out of it, if you keep most of the features away. I assume Google is doing a pretty good job with this. They have a pretty clear style guide that dictates what features are allowed and what are not. However, unfortunately everybody has their own idea of what features should be used and what shouldn’t be used.

The hell breaks loose when there is no common agreement what features in C++ are allowed. The result is a complete mess, and this is where my beef with C++ is. It’s like talking the same language, but not understanding what the other guy is saying. The language provides so many different ways of doing things that nobody could ever learn them all. This is C++’s fault and companies’ fault. If there is no agreed way of writing C++, people will write it as they like, and everybody likes to do it a bit differently. No other language makes this possible. C++ is basically a language with as many sub-languages as there are programmers.

  • Share/Bookmark

4 Comments

  1. You’re painfully right w/this one.

    I haven’t seen a company so far that would have been successful in enforcing the rules about C++. I don’t even know if this is possible, unless you review everyone’s code. Maybe w/C++ you really should?

    Another problem w/C++ is that because it allows you to do almost anything, I’ve seen thinking from at least Cobol, Fortran, Pascal, C and Java in C++ code. This is not something you can easily stop, either, but I’m quite certain that the way C++ is makes this even worse. There’s just no common though or way of thinking that goes w/this language, there’s no real culture around it in the sense of doing things in one well-known and commonly accepted way.

    It’s a gigantic mess of rolling-your-own.

    Actually, it’s more like there’s no vision behind C++. There’s no coherence, no clarity. It really looks like a design by a committee. And it is making things a lot harder than they need to be.

  2. Aare Pikaro says:

    C# would be pretty good replacement for C++, if it wasn’t so slow in some aspects (like interactive rendering). Although not sure how the following technologies compare: C#&XNA vs C++&Opengl. Might be that Xna gives just enough boost to C# real-timeness.

  3. Hello, i think that i saw you visited my blog thus i came
    to “return the favor”.I am attempting to find things to improve my site!I suppose its
    ok to use some of your ideas!!

    my blog :: tummy tuck miracle slimming system – weightloss.askyourfitnessquestion.com -

  4. domain says:

    Thank you, I have recently been looking for info approximately this topic for a while and yours is the best I’ve came upon till now.
    But, what concerning the conclusion? Are you positive about the supply?

Leave a Reply