←back to thread

611 points LorenDB | 2 comments | | HN request time: 0.566s | 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 #
taylorallred ◴[] No.43909532[source]
Cool that you're using areas/pools for lifetimes. Are you also using custom data structures or stl (out of curiosity)?
replies(1): >>43917239 #
1. thrwyexecbrain ◴[] No.43917239[source]
Nothing fancy, I found that one can do almost anything with std::vector, a good enough hash map and a simple hand-rolled intrusive list.
replies(1): >>43920378 #
2. senderista ◴[] No.43920378[source]
std::vector is the only STL container that makes sense to use in practice.