4 ms·
I'm not a full time Rust developer, so your milage will vary: Rust is a more modern language, so there are a number of modern approaches that Rust uses that C+
by wiremine 7y ago
I'm not a full time Rust developer, so your milage will vary:
Rust is a more modern language, so there are a number of modern approaches that Rust uses that C++ can't due to backwards compatibility. And Rust isn't fundamentally an OOP language. I'd say Rust is a bit closer to C than C++, but that's a gross simplification.
But I think what Rust does is forces the developer to address application complexity at compile time, instead of finding out about these problems during run time. Things like segfaults, race conditions, etc. are ferreted by the compiler.
So, Rust might feel more complex, but in reality it's just forcing you to deal with those issues sooner rather than later.
- tomjakubowski 7y agoAnother gross simplification I like is: Rust is a memory safe C with type classes. (traits)
- codesushi42 7y agoTuring complete templates and inheritance make C++ far more complex I'd say then, even at compile time.
- firethief 7y agoI think Rust is closer to C++ in an important way. Rust and C++ provide abstractions in situations where C spells out the implementation explicitly: e.g. Trait objects (virtual inheritance in C++), lambdas (same in C++), enums (no equivalent in C++). To accomplish similar things in C you'd specify how it will be represented at the machine level, e.g. a struct of function pointers; a function pointer + struct pointer; a union + some way of identifying members. Generally this adds a lot of convenience to the higher-level languages compared to C, but it sacrifices flexibility in the special situations where you need that level of control (e.g. implementing an efficient VM you might want the tag of your object type to be more of a bitfield).
- wiremine 7y agoThose are great concrete comparisons.