So many system bugs are because of unclear memory ownership, buffer overflows, and race conditions. C/C++ don’t help you avoid any of these footguns. Any other system that relies on GC is non-deterministic and prone to mystery hiccups, which is why OS and driver tech has been pretty much the same foundation since the 70s.
Rust lets you avoid 2 of those 3 issues (thread race conditions are still a thing). And being compiled, instead of interpreted bytecode means you can get reasonable performance on smaller machines. No wonder these OS guys are so excited.
Yup. Most of my career has been working on embedded realtime software, so interpreted languages are right out and really only C and a subset of C++ are available. I’ve now been using Rust in that way for about nine months now and while the syntax is sometimes silly feeling, being able to not worry about some many other issues has made development much better.
C/C++ don’t help you avoid any of these footguns.
But libraries like Boost do… if you’re writing in raw C++ you’re doing it wrong. A big part of the power of C/C++ is the mature and modern ecosystem built around it.
if you’re writing in raw C++ you’re doing it wrong.
So, C++ is the new Python?
Yes, but nobody in their right mind will use boost at OS kernel or driver level. Also, using C++ has vtable/exception overhead. No-go.
I worked at companies that tried both. They no longer exist.
I’ve worked at plenty of companies that no longer exist, and startups that “made it big,” and big companies that lumber along… how good their programming practices were, how well thier software performed, has just about zero correlation with how well they do in business.
As you point out: different tools are more/less appropriate for different applications. Rust has good overlap with C and C++ places, and in kernel land it’s subbing for C.
I’ve never tinkered in kernel space much - repaired a few OpenGL drivers because nobody else would step up and do it, but I usually stay in the higher abstraction levels. What do kernel people think of libraries like GLib?
Don’t know about “fun again” but definitely a lot less nervewracking and paranoia inducing.
It is hard to think in and see through the eyes from a Kernel core maintainer, if you don’t do this kind of stuff at this level. Instead enforcing style guides, looking for edge cases and unexpected issues because C allows to do anything must be terrifying. Part of this “nonsense” goes away using a language that is designed to handle this better. And you know, learning a new language with features you always wanted to have in C might be exciting too, I don’t know. I can imagine Rust being more fun than C in the Kernel for some, so this is not a wild take or anything like that.
I think the most exhausting part of Rust was two fold: a) the language was not designed to be used in the Kernel, they needed to update and discuss after real world usage, and b) the push back from C developers who either didn’t understand Rust or think its bad for the Kernel. The childhood illnesses of Rust in Linux is seemingly over.
What part of Rust is fun?
C is fun to me because the syntax is easy to understand and straight to the point. C is also great for learning low level coding, I find Rust so confusing
Rust requires you to unlearn some of the C and CPP habits. And so it’s like learning a language that approaches things differently. That is pretty fun to see how another language solves a problem etc. I think rust is a very fun and interesting language tbh. But you are free to not like it, that’s all good man. That’s why we have different languages. After getting into rust, for me, you need to convince me to use C or Cpp, they have their niches for sure, but rust allows that too like embedded programming etc.
This checks out. I tried some Rust coding challenges and couldn’t get my stuff to compile mostly. When I see the solution it seems straightforward but also not intuitive.
Yeah, there’s a lot a cool ways to chain ways to process things and all. Its like building a muscle, I’ve noticed with time and practice (sometimes just repetition after seeing the answer if that works for you) and things get more intuitive. Cause theres a lot of thought on why a pattern is a certain way, and on C you could use teh same hammer for everything. Here you have different tools in a way.






