Remix.run Logo
jandrewrogers 10 hours ago

> I wonder if C++ has some hairy concepts and syntax today

Both better and worse.

The current version of idiomatic C++ is much cleaner, more concise, and more powerful than the version of C++ you are familiar with. You don't need C-style macros anymore. The insane template metaprogramming hacks are gone. Some important things that were problematic to express in C++ (and other systems languages to be fair) are now fully defined e.g. std::launder. C++ now has expansive compile-time programming features, which is killer for high-performance systems code, and is more expressive than Rust in important ways.

The bad news is that this was all piled on top of and in addition to the famous legacy C++ mess for backward compatibility. If you are mixing and matching ancient C++ with modern C++, you are going to have a bad time. That's the worst of all worlds.

But if you are lucky enough to work with e.g. an idiomatic C++20 code base, it is a much simpler and better language than legacy C++. I've done a few major C++ version upgrades to code bases over the years; the refactored code base was always smaller, cleaner, safer, and easier to maintain than the old version.

fc417fc802 7 hours ago | parent [-]

It's much simpler and better than it used to be but it's still pretty bad. As just one example off the top of my head consider the meaning of curly braces for initialization. There's several different things they can mean depending on the context. Good luck figuring out which set is currently in effect.

jandrewrogers 6 hours ago | parent | next [-]

The initialization situation in C++ is indefensibly broken. It is near the top of my list of things I hate about C++.

You can mitigate it with some practices but that this is even necessary is a crime. Initialization is one of the most basic things in software development. How do you fuck it up so badly?

On a day to day basis it doesn’t cause me issues but it offends me just on principle.

germandiago 3 hours ago | parent | prev [-]

Use static analyzers and move on. Almost all the complaints I see about C++ nowadays are removed by max warning levels. Set them as error.

Certainly initialization is the single most confusing feature in C++, I can give you that.

But still doable with s few patterns to remember. And warnings always max level.

bayindirh 2 hours ago | parent [-]

I still use Eclipse CDT and its static analysis is running in real time, as you type code, which is killer. Combined with Valgrind integration, I don't see myself moving on anytime soon.