Lurker News
In the recent years C++ received a lot of backlash due to its complexity and (perceived) feature creep. However, since C++11 I really enjoyed writing C++ with its strict type system (including const), range-based for loops, smart pointers, and how much you can do with templates. On the other hand, I know that it can be very tricky to write, for instance, a correct iterator, to get handling of rvalue references right, or to read error messages that involve templates.

So, do you enjoy or dislike writing C++ source code and why?

Comments (92) 66 threads

Earlier comments
egorfine2 replies#
There is C++ and then there is C++. Totally different things.

One I enjoy programming. Another I dread.

nottorp#
That's the real answer. Which C++?

I'm beginning to believe that some of the Rust evangelists are there just because they'd rather write code in anything but C++...

iExploder3 replies#
I know exactly what you mean. But I would even say there are more C++'s than just two.

"C++, but codebase is 20 years old"
"C++, but we ban or dont like most of C++ features"
"C++, but everything must be a template"
"C++, but codebase is completely new and we only use the new features"
"C++, but its the stl codebase"
"C++, but you are reading Stroustrup's book"

egorfine#
omg that hurts
thisismyanon21 reply#
HP or SGI STL?
sageserpent#
Ha, no - Rogue Wave!
mhelfd#
I think these are the legit version names :)
pjc50#
I'd like to put in a "no" after spending many years writing C++; my day job is in C# now.

The templating system is more powerful than any other language I have significant experience with, but that also lets people write incomprehensible systems. And the compile times always have been really long.

zagal#
I only used it for bare-metal embedded and Linux user space where efficiency was important.

Some features are nice. Some arrived too late, like std::optional in C++17 [0] or std::expected in C++23 [1], and some features requires too deep knowledge of the language, like std::move unable to optimize for containers of structs without "noexcept" in their constructors. [2]
But honestly, the reason why I don't enjoy it is unrelated to the features added to each new standard. It's the build system. I just want to cross compile easily, add sanitizers to testing, and the minimal third party libraries I may need. I think I don't have to explain here how complicated it can get when you have to use CMake/Meson/Bazel, compared to other build systems.
[0] https://en.cppreference.com/cpp/utility/optional
[1] https://en.cppreference.com/cpp/utility/expected
[2] https://0xghost.dev/blog/std-move-deep-dive/

cookiengineer#
Personally, I've never seen anyone write C++ codebases without boost. As you pointed out, the only practical way seems to be to constraint its feature complexity through meta programming.

Coming from the embedded C++ world where resources are scarce, C++ and its debugger ecosystem have been really nice. There were usually strong vendor provided SDKs and cross compilation toolchains available.
The issues I had with the language were mostly dependencies on vendors, not effectively being able to fix problems in SDKs, and as you also mentioned the footguns.
Lots of frustrations came from codestyle, branch conventions and type conventions we tried to encode into templates, which new team members had to learn before they could write any production code. So from a team perspective a lot of productivity came from reproducible build pipelines and setups. Having one team member on Windows and the other on macOS or Linux was as painful as it can get, especially with getting gcc's ecosystem to work properly. So you were also really dependent on Docker cross architecture images. And setting those up just for the sake of compilation was also unnecessary overhead.
These days I've migrated towards Go for pretty much all tasks I can think of, mostly for the tight integration with the C ABI ecosystem and tinygo and the easy possibility to cross compile into fat binaries.
What I miss though is a "real IDE" like the old Visual Studio, or geany or whatever. Most IDEs are not symbol based anymore, which makes them really painful to use in terms of what I expect an IDE to offer to be able to call itself an IDE. But maybe this is just my C++ heart bleeding all over the place because I miss good and typed API documentation examples that I can explore through clicking rather than having to google every function all the time.

Load more comments