3 ms·
I 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
by firethief 7y ago
I 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.