r/cpp • • Jan 09 '22

James Web Space Telescope runs on C++ code.

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

185 comments sorted by

View all comments

Show parent comment

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.