alt.hn

5/19/2025 at 5:45:35 PM

Writing C++ in 2025

https://andreabergia.com/blog/2025/05/writing-c-in-2025/

by gbear605

5/21/2025 at 1:55:35 AM

Yes, if you've spent many years of your life in the Rust ecosystem, and switch over to trying modern C++ for the first time, you will be ignorant of many things. Yes, if you've spent years of your life in Rust you will know it and its tooling better than that of a language you have not spent years of your life with. It's the same for literally any language.

You expect to not have to invest the time and effort to learn a new ecosystem? Just try it out for a week and then complain you don't know it as well as Rust? Almost every single complaint in the article directly stems from the author's lack of knowledge about the tools and language. The fact that the author relies on LLMs to tell them how to configure things really says it all.

by thegrim33

5/21/2025 at 7:37:59 AM

Of course I didn't assume to be 100% productive immediately, and I did spend a few weeks on this experiment, not just some days. My point was more about how even modern C++ felt (to me) dated and annoying to use compared to more modern language, because of the strong (but very valid!) focus on backward compatibility that C++ has. Furthermore, the long history and baggage means that for any thing, there are _many_ different ways of doing it, which doesn't help.

And anyway, it was not a particularly serious (or, for that matter, well written or argued) discussion. As I mentioned in literally the first line, it's just a rant :-)

PS: I am unsure what you mean with "relying on LLM for configuring things says it all". In my experience, this is one area where LLMs _really_ do help a lot - it has been much faster than going through the documentation (which I also did quite a bit of, in particular for conan).

by andreabergia

5/24/2025 at 11:06:46 AM

> Let’s talk about the real stuff: writing C++ in 2025. Naturally I have tried to use the most recent standard, C++20, which has innovative new features such as formatting a string without sprintf, using std::format

C++23 has been around for 2 years, many features are support by most compilers (ahem std::expected)…

> Let’s start with the simplest of things - needing both a .cpp and .h file. I’ve heard modules were a thing, but googling a bit showed that they aren’t really working properly yet, so I ended up not even trying them.

They work fine, the issue is with clangd and even then clangd-19 works fine with modules.

The most annoyance I have with C++ is that it still expects the stdlib to be dynamically linked, which means packaging is a pain and there’s no tooling to make it easier.

Would I write a side project in C++, definitely, my side projects tend to pull in a ton of C libraries that do not have good alternatives in rust. If I don’t need to pull in C libraries I probably don’t need the annoyances of managing memory and lifetimes and I’m writing my code in golang… I have to found the niche where rust is the right tool for the job in my narrow corner, there are places where it is but for me there are the yet.

And I can call C code from golang pretty easily as well…

by jpc0

5/20/2025 at 10:31:58 AM

> One of the thing that annoyed me the most was error handling. I have blogged about this before and I greatly missed Rust’s Result.

The newest standard is C++23 which has std::expected, basically is the same thing

by cherryteastain

5/21/2025 at 2:45:46 PM

Yes, "it’s just the linter being noisy".

by max_k

5/20/2025 at 4:27:55 AM

TL;DR - Rust FTW

by dstanko

5/20/2025 at 9:29:15 AM

They're right I wish I could start writing Rust instead of C++ at work...

by juliangmp