from Hacker News

Writing C++ in 2025

by gbear605 on 5/19/25, 5:45 PM with 7 comments

  • by thegrim33 on 5/21/25, 1:55 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 jpc0 on 5/24/25, 11:06 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 cherryteastain on 5/20/25, 10:31 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 max_k on 5/21/25, 2:45 PM

    Yes, "it’s just the linter being noisy".
  • by dstanko on 5/20/25, 4:27 AM

    TL;DR - Rust FTW