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 (93) 66 threads

Earlier comments
on_the_train#
I like it very much, do it all day at work and in my free time as well. I'm mostly tired by the organized campaign against it.
aktenlage1 reply#
I have a love-hate relationship with C++. I am currently working with C++23 professionally in a complex project, with python layer on-top.

C++11 and later turned the scale more towards enjoyment, but having less time for tinkering and deep diving makes me annoyed. It's not entirely the core language's fault, but since high performance is the name of the game for C++, every library seems to make twists and turns to not leave anything on the table, which increases the cognitive load when writing code, be it performance critical or not. AI now alleviates that quite a bit.
I wish it was as concise as python, e.g. with the list comprehension. When I try to use the newfangled ranges algorithms to replace a (range-based) for loop, I roll it back in 90% of the cases because it neither is shorter nor more expressive.

a1o#
How are you talking with the python layer back and forth?

Have you used Pyomo?

krona#
The metaprogramming features of C++ are the killer feature. Only zig comptime comes close. But zig deliberately doesn't allow operator overloading, so high-performance array/tensor programming APIs aren't anywhere near as ergonomic. Since I work in high performance scientific computing, this is a major drawback.

FWIW I was a Rust contributor, pre v1. I don't see Rust as a competitor to C++, but a 'better c' - you can clearly see this by looking at where Rust adoption is highest.
C++ has a boilerplate problem but at least more recent versions have addressed the biggest pain points - 1000 line compiler dumps of of template instantiation errors are less of an issue.

Theophane_Rame#
I still appreciate C++ for its performance, control over memory, and strong type system

Load more comments