News for hackers. Stuff that matters.
Re:Google says replacing C/C++ in firmware with Rust is easy by pveierland on Saturday September 07, 2024 @10:23PM (#41477766)
Having written quite a bit of C++ firmware and just now spending a few weeks getting into Rust, I have to say the learning curve was less challenging than I thought it would be, and that I feel pretty effective after a short amount of time. The feeling of how sturdy the program is after getting the additional compiler support during development feels very reassuring.

Already at this point I'm hoping that I never need to write C++ again, as the complexity of the language is maddening and only increasing.

(I've only spent a few days on Zig and it was also a very fresh breeze).

Re:Google says replacing C/C++ in firmware with Rust is easy by MBCook on Saturday September 07, 2024 @11:36PM (#41478015)
My question would be is the learning curve better or worse than, say, Swift?

If the curve is small moving from A to B can make a lot of sense. Rust is an obvious possible successor.

But as the curve gets bigger maybe looking at less obvious choices makes more sense. Maybe even a language with a runtime or VM like Java if you’re not doing low level programming like Google is in this post.

Swift is a strawman here. I know it’s probably not there for large non-Apple adoption today, but pretend it was

Re:Google says replacing C/C++ in firmware with Rust is easy by redman25 on Saturday September 07, 2024 @11:59PM (#41478117)
Rust can be written simply if you avoid more complicated features of the language. It depends on what you want to get out of it.

If you want to develop a library, you might have to dig into more complicated features in order to provide a convenient interface for users.

If you want to build an API, using a web framework is simple and doesn’t require understanding the more complicated parts of the language.

Re:Google says replacing C/C++ in firmware with Rust is easy by pveierland on Saturday September 07, 2024 @11:56PM (#41478107)
I wouldn't be able to answer for Swift as I don't know it. However Rust would seem to be a suitable replacement for all use-cases of C++ in an embedded context that I was involved with (including allocation control + static initialization + macro usage).