Hacker News new | ask | show | jobs
by adamjs 861 days ago
Every language has its own merits, there's no single language that's universally the best for every task.

With that said, C++ and Rust both occupy similar domains (high-performance, low-level, often interacts with OS syscalls or hardware).

Pros of C++:

- More mature, excellent library ecosystem, decades of code to reference from.

- Syntax is arguably easier to read and write

- It's very popular (top 6th language on GitHub), lots of talent to hire from.

Pros of Rust:

- Memory safety, it's much harder to introduce bugs of a certain type.

- The borrow checker makes it easier to reason about lifetimes of objects.

- Cargo is great for pulling in libraries (just needs more of them).

For me personally (graphics / game-dev), cost and speed of development is the deciding factor. I use both: C++ by default, and Rust for low-level, safety-critical code.

2 comments

>- Syntax is arguably easier to read and write

This generally comes down more to familiarity than "ease". C/C++ are familiar.

I usually hear about people using Rust with C. You use Rust and C++. If you use them together, how easy is it to call Rust from C++ and vice versa? And can you do that with their standard interfaces instead of watering it down to the lowest, common denominator?