this post was submitted on 26 Feb 2024
266 points (96.5% liked)

Programming

17444 readers
180 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

On the one side I really like c and c++ because they’re fun and have great performance; they don’t feel like your fighting the language and let me feel sort of creative in the way I do things(compared with something like Rust or Swift).

On the other hand, when weighing one’s feelings against the common good, I guess it’s not really a contest. Plus I suspect a lot of my annoyance with languages like rust stems from not being as familiar with the paradigm. What do you all think?

you are viewing a single comment's thread
view the rest of the comments
[–] Croquette@sh.itjust.works 10 points 8 months ago (1 children)

Because there is still market for small mcus. A 1GHz processor is a lot more expensive than a 32 bits 75MHz. If you produce even a low number of units, the price difference can be huge.

[–] frezik@midwest.social 1 points 8 months ago (1 children)

A lot of those mcus don't need to run particularly complex programs. Many of them don't do anything more complicated than reading the status of a pin and using that to activate another pin. 75MHz with a Rust program is more than enough.

For that matter, when Python was first released, the Intel Pentium wasn't even out yet. People made it work. Micropython could handle the above just fine provided the polling rate didn't need to be that high.

It'll all depend on the application, of course, but a huge number of mcu programs could easily be Rust. The performance hit is not that big. The code size on lower end mcus is also going to be naturally limited by their flash space, so even the compiler speed isn't going to be a big hit.

One thing is that the last time I tried using Rust on an esp32, the toolchain was still in its infancy and didn't work very well. Looks like Go has been ported in, as well, but it doesn't support wifi or bluetooth on the esp32. Or even i2c or pwm.

[–] Croquette@sh.itjust.works 3 points 8 months ago* (last edited 8 months ago)

I haven't seen a test on the difference between rust and c, but your last point is the biggest caveat for rust.

If you have been running the same toolchain on multiple products, changing the language means a productivity loss because the devs need to learn the ins and outs of the new language, and if the toolchain is buggy, then it is another productivity loss.

I'm always eager to try out new stuff in products I design, but the incertitude and productivity loss is a no go because I can just spin a barebone code that works in half a day.

Until the tool chain is mature, C will still exist.