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
gignico1 reply#
I love C++, in the C++11 days I even organized a local C++ User Group at my university, and I've used it for the last 20 years as my main language.

I still appreciate its many merits but since a bit more than a year I migrated to Rust and I find it very difficult to look back, except for maintaining my previous C++ projects.
Surprisingly, it's not Rust's memory safety features that I miss the most when turning back to C++. It's mostly the absence of algebraic data types and pattern matching, and the split between compile-time and runtime polymorphism, i.e. concepts vs virtual classes, where in Rust you just have traits and use them for everything. On top of that the tooling and the ecosystem are just amazing.
There's a proposal for pattern matching sitting there under the committee's desk for some years now. With the mess that the standard committee is going through I really doubt they will be able to ship pattern matching for C++29 or even later. Too little too late.
So to answer the question, yes, I still appreciate the merits of C++ but I don't enjoy writing it as much as I have in the past.

bestouff2 replies#
This. Since Rust C++ has lost it's appeal for me. It used to have the good balance of performance/effort, but nowadays I wouldn't dare starting a new project using C++. Even LLMs are way better at coding in Rust.
munksbeer2 replies#
Not a troll question, because I am thinking of starting a fairly chunky project in Rust, potentially around 500k LOC. Are compile times really as bad as people suggest, in Rust? I'll be going agentic development, so it will be iterating a lot.
gignico#
Honestly, coming from C++, Rust seems to compile very very fast. Those who complain about compile times usually come from Go, whose compiler, to be fair, barely needs to parse the code to call it a day. Or from interpreted languages where you don't have to wait at all. But in general, the Rust compiler is quite fast for what it does. If you have a 500kLoC project though, of course it is recommended to split it up into different crates (where it makes sense logically), to speed up even further.
michaelanckaert#
Not an empirical sample but I have project in C++ that I tried rewriting in Rust and I'm very annoyed by the long compilation times. Just my personal experience.
iatroshch#
I found the last part to be true for me as well, LLMs are pretty bad at writing C++ compared to Rust and Python. I believe their proficiency in the latter is due to an abundance of training data while their proficiency in the former is due to the language being "built" to reduce errors.
dotdi#
I agree that C++11 was a big step. This was around the time I was working on a master's thesis, building a distributed optimization framework based around simulated annealing, using hand-optimized CUDA kernels on Nvidia CPUs. Writing CUDA code became a much nicer experience with C++11, and I didn't hate it.

However, it was still a bad choice for all the plumbing, caching, networking, job-management, etc that a useful framework needed, and I started using more and more Python. C++ was frustrating for those bits.
Eventually, after some important work on Numba[0], I was able to replace C++ completely, even for the CUDA kernels, and just write a subset of Python. It wasn't without it's (often quite esoteric) problems, but I was happy to throw out the last bits of C++ code. The thesis was praised and had some outside attention, but fizzled out in the years thereafter.
0: https://numba.pydata.org/

bulbar#
Still loving writing C++ and generally, it got much better over the years. User-Code (vs. library code) is quite easy to understand and it's easy to avoid pitfalls for the most part when using modern practices.

Main problem I see is that it has to move pretty slow. Reflection arriving finally now, but some more modern features might take an additional decade.
It feels however that around C++23/26, a lot of decade-long developings ( i.e.compile time stuff) are getting close to form a complete system without major limitations for the most part.
They also took notes regarding errors and templates, so the user experience also improved a lot (i.e. with concepts).

throwaway81523#
Yes I mostly enjoy it, but I don't do anything critical with it and I'm nowhere near expert level. I use the subset of it that makes sense to me. If I were doing something critical I'd want to use Ada, which I've played around with a little bit.

I think the lurking question is about Rust. I've read a book about it and it has some attractions but also what I think are some poor decisions. I suppose I'll have to use it for something sometime. C++ is sort of like Perl, it seems to me. A lot of what seems like bloat is actually affordances, so the thing you want is often surprisingly close at hand. Some things of course are awful.
I wouldn't call C++ a good language but it does most of the things. Enjoyment doesn't always mean productivity anyway. I enjoy using Forth but that's almost like enjoying riding a unicycle. I wouldn't do anything substantial with Forth except for recreation. I do feel fairly productive in C++.

Load more comments