this post was submitted on 21 Feb 2025
194 points (94.5% liked)

Technology

63082 readers
3563 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS
 

Greg Kroah-Hartman... urged fellow contributors to embrace those interested in contributing Rust code to improve the kernel.

"Adding another language really shouldn't be a problem... embrace the people offering to join us

Thoughts on this?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 42 points 23 hours ago (3 children)

Moving from C to C++ would also not solve any real problem. C++ of course adds OOP which I think can be nice (not everyone agrees with this!) but it also adds an insane amount of language complexity and instability. Mentally reasoning about C code is hard, reasoning about C++ code is nearly impossible.

Rust however brings a novel solution to classes of problems like ownership and mutability with the borrow checker. It's now accepted to be a great tool for writing high performance code while preventing a substantial amount of common, but often subtle, bugs from slipping through. It's not arbitrarily the first non-C code to be accepted in the kernel. And it's used in other operating systems like Android and Windows already.

[–] sugar_in_your_tea 17 points 22 hours ago* (last edited 6 hours ago) (1 children)

In general, for me, Rust > C > C++.

I've heard people say that C is like a loaded and cocked revolver, and if you're not careful, you could blow your foot off, whereas C++ is like a loaded and cocked sawed-off shotgun, and if you're not careful, you could blow your leg off.

[–] [email protected] 5 points 12 hours ago* (last edited 12 hours ago) (1 children)

C++ is a semi automatic shotgun with 200 barrels pointing in all directions.

[–] [email protected] 3 points 8 hours ago

Whilst it's gotten a lot better in the -17 and -20 iterations, the fact that there was recently a doorstop book published solely on the subject of C++ initialisation semantics is pretty telling.

I really like what Herb Sutter's doing around cppfront; I still wouldn't use C++ unless I absolutely had to.

[–] [email protected] 13 points 23 hours ago

Mostly this ^.

There's just not really demand for C++ in the kernel; that's not the case with Rust.

[–] [email protected] 12 points 22 hours ago* (last edited 22 hours ago)

I think rust would also bring in more developers. So more changes would eventually make its way into the kernel.