Back to /thoughts/

Thoughts on C++

I despise C++ for a lot of reasons. I have some reasons that are opinionated and others that are... less so.

I'll start with the more opinionated points, then go to the points I believe are more objective.

Syntactic Shortcomings

This is one of the more common reasons that people dislike C++, and for good reason. C++ has a lot of really weird syntaxes that are questionable at best. The main example I think of is the abysmal syntax for writing a line to stdout:

std::cout << "Hello, World!" << std::endl;

Why... why the heck did the C++ committee think that it was a good idea to use a left bitshift operator overload for this... Even disregarding the syntax, this is also just flat out bad practice in my opinion. I'll get to that when I talk about operator overloads.

Technically this isn't part of the syntax as much as it is the stdlib, since this is just an operator overload on an iostream. However the syntax of the language follows a similar style. The difference between a class and a struct, for example, is just the default access modifier. This is... weird to me, why don't you just use the struct keyword and add method support to it? Or better yet, don't even touch struct and leave it as a basic data structure instead of making it an OOP structure by default.

Templates fit for a King- er- Turing Machine

Okay don't get me wrong, I love polymorphic programming via templates. What I don't like is the complexity of C++ templates. Ever wanted turing complete templates?

A template for the purpose of polymorphism only needs a type parameter or two, i.e, template <typename T>. Everything else would be used in things other than polymorphism more often than not, and at that point I don't think a template is the right tool for the job.

C++ templates are certainly powerful. They're just... a bit *too* powerful in my opinion.

A double-whammy on templates and syntax: it took the C++ committee 32 years to improve the parser spec to parse >> properly in nested templates (C++11).

Can Bitshifts Write Data? (Operator Overloading)

This isn't unique to C++, but I'm including it here due to the atrocities of the left bitshift ("stream write") operator overload.

Operator overloading makes it harder to tell what's going on under the hood. For a language that's built on C, I don't like being able to mask code like that. Of course I can always just jump-to-source, but the beauty of C to me is that I can look at any line and have a really good idea of what the ASM output will look like. In C++, as soon as I use an operator on a custom type from a library **or even the language's own standard library**, I don't know what that ASM could look like, and there could very well be a side-effect too that I didn't know about.

Memory "Safety"

C++ provides a variety of different pointer types, shared_ptr, unique_ptr, weak_ptr... they're all useless in my opinion. This could just be me being used to C pointers, but I really don't think that having different types of pointers is necessary. Feel free to disagree with me here, I won't judge you for that ;P

I've met a lot of people who use C++ because they believe it's more safe than C (especially people new to it), when in reality there are *more* pitfalls in C++ than in C. You can easily misuse a pointer type, use the wrong cast (C-style casts are different than C++-style casts), or leak memory just like in C. C++ is *not* safer than C, if anything it's *less* safe, and the false sense of safety that beginners tend to have doesn't help.

The Standard Library

I'm no stranger to bad standard libraries. But C++'s really stands out from the rest because it's just *that* bad.

The stdlib of C++ took: (C++ was created in 1979, for reference)

Additionally, the C++23 spec (ISO/IEC 14882:2024) is... 2104 pages. Two THOUSAND pages. The C23 spec (ISO/IEC 9899:2024) is 758 pages. I don't have many other specifics on this since you have to *buy* the PDFs to read them, thanks ISO (sarcastic).

Obviously some of the spec is the syntax and such too, however a lot of it is also going to consist of the standard libraries. I would get numbers for how many pages correspond to each language's respective standard libraries, but I'm not about to fork out over almost $553.30 USD to buy each spec for that.

For reference: both the C++23 and C23 document cost 221 Swiss Franc (236.39 EUR or 276.65 USD as of 07/07/2025). I.e, $553.30 USD to get both. The links above for the ISO/IEC are to the ISO pages where I got the price and the page counts.

"C++ is just better C"

C++ and C are *fundamentally* different languages. C++ aimed to add an OOP paradigm to C, which completely changes how you go about writing code using the language. Their standard libraries are vastly different too. C provides what you *need*, C++'s is sugar on top.

Note

This page *is* intended for me to explain why I dislike C++, but it is *not* me intending to diss those who use C++. It's a perfectly capable language and I have absolutely zero judgement for anyone who uses it. I just happen to have plenty of judgement for the language itself.