Menu

1 / 2

Rust vs C++: Who Checks the Lifetime, and When

DEV Community: cpp·Qasim Parray·about 23 hours ago
#dXQokj4F
#devtocpp#devto#dev#include#rust
Reading 0:00
15s threshold

Short version for the impatient: the real difference between Rust and C++ is not speed. Both compile to native code and both can hit the same hardware limits. The difference is who checks your lifetimes, and when. C++ lets you check them yourself, with discipline and tooling. Rust makes the compiler check them before the program exists.

I want to show that with a small program rather than a slogan, because I've read a lot of "Rust vs C++" posts that are just two benchmark charts and a fan club. I write mostly PHP, Go and TypeScript for clients, so I'm not a systems programmer, and I won't pretend to have shipped a game engine in either language.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.