r/cpp • • Jan 09 '22

James Web Space Telescope runs on C++ code.

https://youtu.be/hET2MS1tIjA?t=1938
726 Upvotes

185 comments sorted by

View all comments

Show parent comment

21

u/tarranoth Jan 09 '22

It's gaining some traction, but it is a little bit limited with the llvm backend. I know there is the gcc experimental stuff, but I'm not entirely convinced that that would make people write rust instead of C. I think for stuff like raspberry (or basically any thing that at least still runs an os), it might see usage, but I don't think it makes much sense for bare metal.

7

u/rswsaw22 Jan 10 '22

I also think for any memory mapped hardware you need to use the unsafe keyword to access it. Which ruins the big selling point of Rust, its safety. And as someone who works in the embedded space, Rust is a hard selling point when it doesn't have vendor supported tools. It's a pain to self wrap a dev environment for a uC and it is just easier to reach for C++ when I want better type safety as I can just use the vendor provided IDE and debugger.

3

u/pjmlp Jan 10 '22

All systems programming languages need unsafe at some level, the issue with languages that are copy-paste compatible with C is that the whole code is unsafe.

The only way to prevent it is with help of castration standards like MISRA and AUTOSAR.

2

u/rswsaw22 Jan 10 '22

Right. I agree with all of that. But for bare metal programming that's a lot of code that ends up using unsafe in Rust when I played with it. Still like the language a lot, but for right now professionally it's just easier to reach for C or C++ and apply the above standards you mentioned.