←back to thread

611 points LorenDB | 2 comments | | HN request time: 0s | source
Show context
thrwyexecbrain ◴[] No.43909187[source]
The C++ code I write these days is actually pretty similar to Rust: everything is explicit, lots of strong types, very simple and clear lifetimes (arenas, pools), non-owning handles instead of pointers. The only difference in practice is that the build systems are different and that the Rust compiler is more helpful (both in catching bugs and reporting errors). Neither a huge deal if you have a proper build and testing setup and when everybody on your team is pretty experienced.

By the way, using "atoi" in a code snippet in 2025 and complaining that it is "not ideal" is, well, not ideal.

replies(5): >>43909244 #>>43909532 #>>43910069 #>>43910728 #>>43913902 #
mountainriver ◴[] No.43910728[source]
I still find it basically impossible to get started with a C++ project.

I tried again recently for a proxy I was writing thinking surely things have evolved at this point. Every single package manager couldn’t handle my very basic and very popular dependencies. I mean I tried every single one. This is completely insane to me.

Not to mention just figuring out how to build it after that which was a massive headache and an ongoing one.

Compared to Rust it’s just night and day.

Outside of embedded programming or some special use cases I have literally no idea why anyone would ever write C++. I’m convinced it’s a bunch of masochists

replies(4): >>43911653 #>>43911797 #>>43912055 #>>43912710 #
runevault ◴[] No.43911797[source]
When I've dabbled in C++ recently it has felt like using CMake fetching github repos has been the least painful thing I've tried (dabbled in vcpkg and conan a bit), since most libraries are cmake projects.

I am no expert so take it with a grain of salt, but that was how it felt for me.

replies(1): >>43916840 #
1. kylereeve ◴[] No.43916840[source]
Do you have CMake actually run `git clone`, or do you clone separately and point CMake at the `FIND_X` files?
replies(1): >>43917945 #
2. runevault ◴[] No.43917945[source]
I was using fetch content or the like, there is a package that comes after a certain version of cmake where you can tell it this is a git repo and it handles all that for you. It has been a few months since I did this so I don't remember the details fully