15 points hasley 55 minutes ago 6 comments

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?

mort96 15 minutes ago | parent

I enjoy writing C++ code.

I acknowledge that C++ is a bad language in a lot of ways, but it's a bad language which I know really well, and it fits with how I think about code. And it lets me effortlessly do "clever" things with how memory is managed to avoid unnecessary allocations etc. I've already learned most of its idiosyncrasies, handling rvalue references/move semantics, how to go about implementing contracts like iterators and containers, etc.

I also like writing Rust, and I like how Rust makes sure I don't make mistakes. I think Rust is a better language in many ways and I think it's the future of low-level programming (and I think it's wild that it took so many decades to get a proper competitor to C++!). But I also like how C++ doesn't care and lets me do whatever I want without acting as a nanny. I would never ever dare to write a publicly exposed web server in C++, but a game? Sure!

arya0 15 minutes ago | parent

idk but my claude seems to really enjoys writing code in C++

adev_ 12 minutes ago | parent

In one word: Power.

C++ is by far the most powerful language around. And this is for the best and (often) also the worst.

In term of generic programming, control on hardware, capacity of abstraction and more generally expressivity: Nothing, even today, come even close to C++.

It is a language full of foot guns and it has its fair share of legacy problems.

But if you learn to avoid it (throught experience and pain). You can reach a productivity and a level of performance in C++ which is very difficult to beat with anything else, including Rust.

Ironically, I find it particularly true in the age of A.I.

Because the amount of C++ around is so tremendous, that agents are currently pretty good at it if guided properly.

egorfine 12 minutes ago | parent

There is C++ and then there is C++. Totally different things.

One I enjoy programming. Another I dread.

logicchains 11 minutes ago | parent

I like writing in C++ because Claude does most of the work and if I structure the source well it compiles much faster than my Rust code.