News for hackers. Stuff that matters.
Re:"No way to prevent this" say users of only language where... by yetihehe on Wednesday May 22, 2024 @04:04AM (#40438484)
Simple | Fast | Safe. Choose two.
Re:"No way to prevent this" say users of only language where... by izacus on Wednesday May 22, 2024 @04:21AM (#40438610)
People overwhelmingly chose Simple and Fast. Still.
Re:"No way to prevent this" say users of only language where... by jamesdhutton on Wednesday May 22, 2024 @05:08AM (#40438934)
Exactly this. It's all about trade-offs. You need to pick the right tool for the job. Sometimes the right tool is dangerous. Knives are dangerous tools, but you need them if you want to cook a meal.
Re:"No way to prevent this" say users of only language where... by yetihehe on Wednesday May 22, 2024 @05:33AM (#40439069)
I love one comparison to hole hawg[0] (used for unix vs windows&mac), which is usable here. Memory safe languages are like a fancy electric drill from target. They get the job done, but if you want some more serious drilling they die on you instead of doing something dangerous. C is like one of those drills which are comprised of engine and a handle (cheap, changeable piece of steel pipe). They are designed to do one thing: they rotate a drill. When drill blocks, they rotate you. But when you take appropriate precautions, boy do it drills...

This is from my favourite book: In the beginning was the command line.

[0] https://web.stanford.edu/class/cs81n/command.txt , search "HOLE HAWG".

Re:"No way to prevent this" say users of only language where... by superb_dev on Wednesday May 22, 2024 @02:05PM (#40444047)
So what are you able to do with C that you can’t do in Rust? Somethings are more difficult to pull off, but everything possible in C is possible in Rust. Worst comes to worst you can always drop into unsafe Rust

This “sometimes you need a knife" argument just doesn’t make sense. You can have the power and the safety. Stop cutting off your fingers.

Re:"No way to prevent this" say users of only language where... by yetihehe on Thursday May 23, 2024 @02:19AM (#40451104)
Make a program for 8051 MCU. Or a lot of other microcontrollers.

> This “sometimes you need a knife" argument just doesn’t make sense. You can have the power and the safety. Stop cutting off your fingers.

Sometimes you need a scalpel.

I'm not against Rust. I still want to start a project where Rust will be worth learning for me, but I'm currently busy writing erlang and java for big systems and C for microcontrollers. This is of course only my local situation, I don't advocate for those languages (I love erlang though and I'm wishing for advertised easy concurrency in Rust, maybe someday).

Re:"No way to prevent this" say users of only language where... by superb_dev on Thursday May 23, 2024 @03:16AM (#40451513)
Actually I’ve been pleasantly surprised by Rust on the Arduino! Things are certainly much easier with the large community behind it, I probably would’ve chosen C if there wasn’t an existing community.

I don’t think Rust should be used everywhere, but I’m firm that it could be used anywhere that C can (short of an unsupported architecture).

Re:"No way to prevent this" say users of only language where... by erik_seaberg on Wednesday May 22, 2024 @08:06PM (#40448603)
Sacrificing safety might have been defensible on a 40 MHz 80386 that could barely run a C++ compiler (I think this is what I started my career on) but today we find eight-core 3.8 GHz CPUs in desktops and dual-core 1.8 GHz SiPs in wristwatches. Safety should have become table stakes a while ago; Moore's Law already paid for it.