Hacker News new | ask | show | jobs
by galenguyer 2113 days ago
I typically see Rust marketed as a better replacement for C. In what cases isn't it a practical replacement?
3 comments

Rust is a fine replacement for C++, but not really for C, and the reasons why Rust can't be a replacement for C are very similar to why C++ can't be a replacement for C. Everybody who chooses C today has slightly different reasons to do so, but one important reason is that C is a very small language with a very small standard library, and most parts of the standard library can be ignored without losing any of the "qualities" of the C language. IME a small language feature set makes it easier to evaluate and integrate third party code, it's hard to say exactly why that is, but that's my experience anyway. Of course one could say "nobody forces you to use the whole feature set of Rust", but the same has been said in the C++ world for decades. The problem is that everybody selects their own subset of the language when having the choice.
Core Rust is very small language. It doesn't have memory allocator, so it can be used in embedded, where heap is not available. C++ cannot do that.

https://doc.rust-lang.org/core/index.html

Its a replacement for c++ not c
When you’re targeting platforms that Rust doesn’t, have a lot of legacy code that can’t do for a new toolchain, or cannot handle dependencies.