←back to thread

11 points dacsson | 1 comments | | HN request time: 0.207s | source

I know that ~70% of embedded systems are programmed with C, lots of movement or at least motivation is seen on moving to Rust. My question is: why this languages are good for embedded software development? And overall what would constitute a good PL for this domain?
Show context
JohnFen ◴[] No.43729182[source]
C works well for embedded systems programming because, at heart, it's "a better assembly language". That is, it gives greater convenience and readability with minimal additional overhead in terms of binary size and speed (compared with assembly).

That said, I tend to use a small subset of C++ (combined with straight assembly for critical portions) rather than C. In essence, using C++ as a better C as a better assembly.

I think that any language that allows you pretty tight control over what the compiled code looks like, is deterministic, and compiles to something small and fast, would do for embedded systems programming. C, C++, and assembly do the job nicely for me, but is hardly the only good approach. If another comes along that is significantly better, I'll happily switch to it.

I couldn't tell you what that would look like, though, as my current toolsets aren't leaving me wanting for anything.

replies(1): >>43729285 #
zeroCalories ◴[] No.43729285[source]
Yeah for the reasons you stated I would want to C, but with a better type system, no UB, some of the foot guns removed, and maybe some cool static analysis for stuff like invariants and stack size guarantees built in.
replies(1): >>43730592 #
1. hyperbrainer ◴[] No.43730592[source]
You are looking for Ada.