Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> Would anyone choose C for a new systems project with no legacy baggage or dependencies, in a world with Rust and Go?

I imagine it is easier to hire C programmers than Rust programmers, at the moment, especially in fields like embedded development.



sort by: page size:

> Would anyone choose C for a new systems project with no legacy baggage or dependencies, in a world with Rust and Go?

While Rust might be feasible, Go can't really provide libraries like SQLite: Go's C compatibility story is disappointing and awkward.


> The disparity between Rust jobs and C/C++/C#/Java/Golang jobs on Indeed is staggering.

Most of the world are things other than real systems programming. C++/C#/Java/Golang are likely better choices for this than either C or Rust.

But a C-like language is necessary. Rust may be (very slowly) displacing C for systems programming.

As you mention, it takes awhile for the pool of experienced developers to show up.


> Would anyone choose C for a new systems project with no legacy baggage or dependencies, in a world with Rust and Go?

From a professional standpoint, you might as well be asking if I have infinite money and time. Nothing happens in a vacuum

But ignoring that, I would say, for me, it boils down to:

1. How important is performance? Is this a case where all that really matter is that it works? That I have a decent algorithm? Or am I going to be doing "real" optimization, even if only for a single platform? Even at just the "is my algorithm good?" stage I would lean toward C/C++ for systems work.

2. And this is the important one: Do I need this code to exist and be usable in one year? Five? Ten? Stuff like Rust might be fine for the one year frame, but for even as few as five I am going to want something established that I know will have support. And that means C/C++ for systems development (python, ruby, and js for scripting, and so forth).


> I'm curious, as a C developer, would you say that you prefer Go over Rust?

Not the guy you asked, but coming from a similar background: Yes, I absolutely would.

Reason: Rust is an amazing language: Amazingly safe, amazingly fast, amazingly complicated. And the last isn't an advantage but a huge showstopper. What do I get from Rust over Go? A bit more performance. Okay, but I also get that from C, so the real question is, what do I get from Rust over C? Memory safety guaranteed by the compiler. Cool. But in exchange, I have to learn a language easily as complex as C++, but completely different from C.

No thank you.

Bottom Line: For me, the advantages of Rust over C do not justify the added complexity, not even close.


>guess any dev who can write Rust today is also a good C dev,

I'm sure they have the potential, but they might not want to learn/use C.

I'd certainly be much more likely to look at kernel dev if I can use rust than if I have to use C.


> Without the disadvantages? What advantage does C hold over Rust if you value a composable language which is safe and expressive?

Having existing C codebases in production which are time-tested and stable and reliable is a huge advantage of having to rewrite them from scratch, don't you think?

Also, you can check out C code from 20 years ago and build it in your personal laptop with ease, and be able to do the exact same thing 20 years from now. Meanwhile, Rust still fails to put together a single specification, let alone a standard one, and relies on reference implementations that may or may not exist in a few years.


> Where doesn't Rust 'compete' with C, and where is C the better choice in a kernel?

My opinion as someone who writes C for embedded devices and has started to play with rust:

C is better than Rust primarily when the C code already exists and the Rust code doesn’t.

Rewriting the kernel will probably have little impact in terms of performance for the user, the main benefits would be for developers, because Rust can be more expressive (less boilerplate and simpler ways to do some things), and it should have less bugs, since it’s performing more complex checks than C code would.

For me as an individual, I’d prefer to be writing Rust, I find it much more ergonomic (for my workflow at least). The main drawback I have is that no one else in my team really knows Rust (although that’s slowly changing).


> What advantage does C hold over Rust if you value a composable language which is safe and expressive?

Language stability, tons of tooling, validation, decades of experience, plus the fact that you might have spent 500 million dollars to develop your existing codebase.

Not to mention Rust is still a moving target and it's not ratified for safety-critical uses.


> Most systems programming jobs these days is C/C++ on Linux and will be for the foreseeable future.

I don't disagree, but at least anecdotally a lot of the shops I've been involved with/worked with are really excited about Rust and Go. A previous employer that used C++ exclusively has even shipped a few Golang based tools, and is planning to introduce it into the main product soon. No new projects are being started in C++ either.

Definitely recommend learning C, but having Rust (or Golang) exposure will likely be helpful in the near future.

Great post btw.


> Why on earth would someone would pick C to start a new project in 2020?

Please ask yourself this before writing any code (For a cross-platform game).

By just reading this, I thought to myself if I were to write a cross-platform game in 2020, Is C necessary to accomplish this? Perhaps anything C can do, surely Rust can do it safer and arguably better.


> It is not fun but frustrating to work in Rust, and contrary to C, you are limited by the language/compiler on what you can do.

People who have had prior exposure to C tend to find Rust frustrating.

People who have not had prior exposure to C tend to find it fun, and an average programmer of this sort can fearlessly write bare-metal code that beats the code of the best C programmers writing in C in safety and rivals it in performance.

Systems programming has been fundamentally changed by Rust. It's become as accessible and democratized as web programming, no longer the sole province of a cadre of elite C programmers.


> What's the motivation to continue releasing greenfield projects in C?

People like C. I like C. I like Rust too but I like C more.


> Hiring programmers proficient in Rust is much more difficult than in C or C++ due to the smaller user base. Example code, tools, and libraries released by MCU manufacturers are almost always for C or C++. The Rust embedded infrastructure is new, and rapidly changing.

While Rust cost per engineer today is higher, is the cost of the project lower, because due to Rust those engineers are much more efficient?


>guess any dev who can write Rust today is also a good C dev, ain't it?

Quite a number of Rust devs I've read about, have never been C devs. They came from dynamic languages or Java or similar, and stuck with Rust and learned it, as a more modern features-wise and less error-prone systems language than C.


> In particular a strong point of Rust is that C programmers feel comfortable switching to Rust in way that has not happened with other safe languages.

I don't see this at all. C++ programmers might be switching, but C programmers aren't reaching for Rust when they need something better than C.


> one advantage with Rust is that it plays well with C

Advantage over what? This can be said about the majority of programming languages

For example, I’ve recently done an embedded ARM Linux project where I used C# and .NET Core for higher level parts, C++ for lower level, [DllImport] and C API between the two.


> Rust is great, but if one is looking for a job in systems programming, C and C++ is what gets one hired, regardless of their flaws.

That's true, but as a beginner I feel like starting with Rust is a lot more accessible, and could help someone switch into C++ later.


>It seems to me that Rust isn't even really intended to compete with C for the use cases in which C is dominant in 2023.

Like?

What other you guys do in C that isn't just integer oriented programming (using ints for everything)?


> So I'm thinking of investing in learning a more contemporary tech stack to stay relevant and employable. Doing mostly systems work (performance matters which is why we write in C) I was thinking maybe rust is a natural step for me but then again I worry that it won't get much traction in companies (lots of pushback from devs and management invested in older stacks, learning curve, not time tested etc).

Rust, companies are already investing heavily into it.

next

Legal | privacy