If I’m building a robot that is going into space, or if I’m building a robot that is being cost-engineered for massive volume, would I use C or Rust on a microcontroller.
That’s quite the question! To my knowledge, Rust isn’t well supported on MCUs just yet, although that is a goal for this year. The best way to know if Rust is right for you is to dive in.
At the moment I am deciding whether I should learn either C, C++ or Rust and I don’t want to waste time learning and investing my time with one language, only to find out that this language can’t do what the other language can and should have learn’t that language etc. That is what I want to know mate.
If you have to only learn one, then at the moment I think it should be C. Both C++ and Rust have much less compiler support in the embedded space.
Do you know the microcontroller architecture it will be on? If so, check if it’s supported by LLVM/Rust.
If it is supported, and you’re a beginner, Rust may actually be a good choice. Rust is focused on robustness and preventing a lot of errors at compile time. C and C++ leave that to the programmer, which requires more experience to get programs right. If you’re going to ship your first program at massive volume, you don’t want to ship code with some dangling pointer error.
C is the best option here. However, learning any of them would never be a waste of your time. My cursory knowledge of C helped me a lot learning Rust, and learning Rust made me a better programmer in general. Rust - contrary to what many say - isn’t that difficult to learn, especially if you have experience with languages like C.