140
submitted 1 month ago by cm0002@lemmy.world to c/linux@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] onlinepersona@programming.dev 56 points 1 month ago* (last edited 1 month ago)

What is wrong with the commenters on Phoronix? There seem to be a bunch of old dudes who can't accept that C is unsafe and no amount of "skill" will prevent it from being unsafe. They look at 3 decades of unsafe C with thousands of CVEs and still think it's a skill issue.

Anti Commercial-AI license

[-] The_Decryptor@aussie.zone 30 points 1 month ago

If you think the comments about Rust are bad, you should check out any article about X11/Wayland or systemd.

[-] onlinepersona@programming.dev 17 points 1 month ago

Yeah, I don't understand the wayland and systemd hate. Personally, the alternatives are worse in many areas. managing services before systemd was terrible and I'm very happy it's here. Making services depend on magic comments is a terrible system IMO. Can't remember if that's upstart or rinit or whatever.

Anti Commercial-AI license

[-] Feathercrown@lemmy.world 5 points 1 month ago

Wayland hate I at least understand. Their security model makes it not a 1:1 replacement for X11 yet, but that's what it's marketed as.

There's definitely stuff it breaks. I still miss Autokey.

[-] _____@lemm.ee 24 points 1 month ago

I love C and C++ and I talk to someone else who does (comp sci grad) but he's hugely biased against rust and says shit like "rust is cringe it has training wheels, just be good at C"

it's like a weird tech anti-intellectualism

[-] Piatro@programming.dev 1 points 4 weeks ago

It's just elitism. They think because they've suffered to learn C and have learned all the footguns of the language that they are smarter than people who haven't, so they see anything higher level than C as being a baby language for babies. 30 years ago I'm sure there was the equivalent of people who exclusively worked in assembly who thought the same about C programmers.

[-] pressanykeynow@lemmy.world 1 points 3 weeks ago

30 years ago I’m sure there was the equivalent of people who exclusively worked in assembly who thought the same about C programmers

Isn't it exactly the point Linus was making about Rust?

[-] moonpiedumplings@programming.dev 24 points 1 month ago

There are exactly 3 types of phoronix commenters:

  • Trolls
  • People falling for the trolling
  • Professionals working at intel, red hat, etc who use that site as some kind of communications board for some strange, unknown reason
[-] missphant 24 points 1 month ago

If you open the comments on Phoronix you have already lost.

[-] onlinepersona@programming.dev 7 points 1 month ago

Learning that the hard way 😂

Anti Commercial-AI license

[-] cm0002@lemmy.world 16 points 1 month ago

The C/C++ fandom is...something else. For many, C is perfect for every use case and everything else higher level from C# to JavaScript is nothing but inefficient waste for programmers who aren't good enough for something like C lol

[-] BassTurd@lemmy.world 9 points 1 month ago

Technically, it is a skill issue though, but requires borderline perfection to achieve safe code. It's still a bad argument and detracts from progress in an area where it's sorely needed. Correct me if I'm wrong, but my understanding is that everything unsafe is because the logic used left something exposed where rust has rules in the language the prevents those had coding practices. C is inherently unsafe, it just doesn't have built in safe guards to keep the dev from using it wrong.

[-] onlinepersona@programming.dev 9 points 1 month ago

Technically, it is a skill issue though, but requires borderline perfection to achieve safe code

If near perfection is the minimum to achieve a goal, then it can't be a skill issue, IMO. But I agree with the rest. It's a terrible argument that keeps getting repeated, not only for C but many other places in the tech world.

Anti Commercial-AI license

[-] GolfNovemberUniform@infosec.pub 5 points 1 month ago

Well performance is important and Rust is fast on paper afaik but idk how it works in real use cases. I don't remember seeing performance benefits on Rust compared to other languages that are not C.

[-] onlinepersona@programming.dev 17 points 1 month ago* (last edited 1 month ago)

There's a paper about this and with C as the baseline, Rust was 4% slower for the specific tests they ran.

In these tests, Rust is actually faster than C sometimes.

So it really does depend on the workload. However, the safety that rust provides cannot be understated. It's easy to cut corners like in C, but it's difficult to do it right. Rust provides the closest result of right and fast.

Anti Commercial-AI license

[-] GolfNovemberUniform@infosec.pub 5 points 1 month ago

I do agree with you. Safety is important nowadays. Though if there's a use case where Rust gets a very noticeable performance disadvantage (like UI), it may be better to just use C.

[-] onlinepersona@programming.dev 7 points 1 month ago

Like UI? Was that a hypothetical or a real example?

Anti Commercial-AI license

[-] qaz@lemmy.world 3 points 1 month ago* (last edited 1 month ago)

I wrote a GTK application in Rust some time ago and it was filled with macros to deal with lifetime issues. Most issues could only be solved with unsafe macros or Rc<RefCell>. The experience working with it is probably a lot better when using newer declarative frameworks, but using it with a toolkit written for C wasn't fun.

I personally prefer it for cli programs. The executables are considerably larger than C programs due to static linking, but that does mean that it works regardless of what libraries you have installed without any hassle.

[-] onlinepersona@programming.dev 4 points 1 month ago

Rust on top of a C/C++ lib is not fun, that's for sure. It has to setup a firewall around C which adds complexity. Using a rust native framework is better, IMO. Slint and egui are good examples thereof.

As for application size, check this out.

Anti Commercial-AI license

[-] qaz@lemmy.world 5 points 1 month ago

Yeah, I wrote two "plugins" some time ago and the Assembly implementation was shorter than the Rust implementation due to the need to convert from C ABI and back 😅.

I have taken a look at both Slint and Egui before, but they didn't seem to integrate that well with the Linux desktop last time. I just checked again and it seems like Slint has a Qt backend now which is nice. I don't really like immediate GUI frameworks, but JavaFX has so far been my favorite framework to work with so maybe I'm just weird.

And yes, I have used min-sized-rust's tricks for several of my projects, and it's very effective. However statically compiling just doesn't compare to using C and linking with the system libraries.

[-] onlinepersona@programming.dev 2 points 1 month ago* (last edited 1 month ago)

JavaFX has so far been my favorite framework to work with so maybe I’m just weird

I found Java Swing to be the easiest GUI framework to use. Never tried JavaFX. Would you call it an upgrade?

However statically compiling just doesn’t compare to using C and linking with the system libraries.

Rust does support dynamic linking (doc, stackoverflow), but AFAIK the crate has to explicitly be configured to do so (I might be mistaken though as I've never tried it). And from what I gather the rust ABI isn't stable (which is a pity) so it's "safer" to output a cdy-lib than a dy-lib.

Maybe in the future the rust ABI will be stabilized.

Anti Commercial-AI license

[-] qaz@lemmy.world 2 points 1 month ago* (last edited 1 month ago)

It is definitely an improvement over Java Swing. One thing I really love and miss with other frameworks is how easy it is to connect properties with each other. All values are exposed as Properties and Values. Values can be listened to, mapped and used. They are similar to RXJS's Observables except that you can always get the internal value without a lastValueFrom that may fail. Properties can also be listened to, mapped, etc but their value can also be set from everywhere (RXJS instead has Subjects which can only be set from inside the constructor). It's a really easy, yet powerfull system. I have yet to find a single framework that does that part as well as it does.

And regarding Rust lack of stable ABI, even if that's resolved (and last time I checked there wasn't much interest from within). The main Linux distributions will still have to ship the Rust stdlib as a shared library to be able to reliably depend on it being available.

I do wonder if it would be advantageous to write a safe wrapper around the C and C++ standard libraries. It would mean being able to use it's functionality, while being relatively sure that those dependencies are available while only having to add a little extra code (and thus size) to the executable for the wrappers.

[-] GolfNovemberUniform@infosec.pub 2 points 1 month ago* (last edited 1 month ago)

Someone said Rust wasn't very good at UIs in terms of performance. Though I don't remember where it was published.

this post was submitted on 29 Jan 2025
140 points (100.0% liked)

Linux

6208 readers
236 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS