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

Show all comments

Showing thread 5 of 66

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.