this post was submitted on 16 Jul 2023
474 points (100.0% liked)

Programmer Humor

852 readers
4 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

No offence

you are viewing a single comment's thread
view the rest of the comments
[–] Ret2libsanity@infosec.pub 1 points 1 year ago (2 children)

Rust won’t replace c.

The programs are too bloated for many embedded systems where every byte counts because it’s in ROM or loaded jnto IRAM

All that memory safety and garbage collection, for example, comes at a big cost

[–] Faresh@lemmy.ml 1 points 1 year ago

garbage collection

I don't think Rust has a garbage collector.

[–] Auburn 1 points 1 year ago

Rust actually doesn't have a garbage collector! The point of Rust is that memory safety is statically verified at compile time, automatically inserting allocations and frees. The bloat of Rust binaries in my experience comes from excessive code generation such as generics or macros. If you're aware of that, though, you can avoid the more bloaty bits (such as the string formatting machinery) and compile some quite tiny binaries. For example, I was able to write a simple GameBoy Advance game that only took 2kb of ROM including the assets.

That said, C still very much has its place, but Rust can definitely do embedded.