Hacker News new | ask | show | jobs
by yorkedork 3927 days ago
This response is neither productive nor insightful.

First, it's probably not useful to arbitrarily claim what the biggest flaw in the design of C is without context or data.

Second, I don't think it's reasonable in this case to place the blame on the design of a language (certainly, the choice of C has long been a pragmatic decision). As Linus alludes to directly, the tools exist with which to write more correct, idiomatic C code for the kernel (e.g., ARRAY_SIZE and a useful gcc warning).

Finally, as the historical record should demonstrate, 'getting rid of X by replacing it with Y' is not particularly actionable; it certainly isn't the most efficient solution in terms of resources and likely not in terms of correctness over the short- to medium-term.

If I'm to hazard a guess, the point of his message was to remind everyone the biggest source of flawed code lies in our own hands and in the biases individuals and groups bring to large-scale development.

The choice, here, isn't between using a good language and a bad language; it's between using a language and its idioms correctly, and using those things lazily with foul consequences.

1 comments

the choice is also between a good language and a bad one. Those two choices are not exclusive, and choosing good practices is not the end of the road for the quest for quality.
No. There's only one language you can write a patch for the Linux network stack in — C.

"Move to Rust!" is not a productive or helpful suggestion, unless you have an massive army of programmers ready to port Linux to Rust.

You can write a patch for the Linux network stack in any language you want. Whether Linus will merge it is a different matter. :P

EDIT: Downvotes eh? Then I suppose I'll state outright what I left implicit: Linux is not inextricably tied to any single language, and it's a strawman to suppose that any attempt to integrate Rust with Linux would first have to reinvent the universe from scratch. Rust has excellent interoperability with C (though, notably, unions are iffy), and it's common to write Rust code that gets called from C with C being none the wiser.

For the record, I don't have enough karma to downvote.

>Linux is not inextricably tied to any single language

It is pretty tightly coupled to GCC, which, as you know, is a C compiler. Some people are working on supporting Clang, but last I heard they haven't succeeded.

It would certainly be interesting to see someone link Linux to Rust code though.

Linux has been built with small modifications under tcc, icc and llvm. Linus doesn't want it to be tightly coupled to GCC.

The LLVM build patchset is being actively maintained, here hare slides from February: https://events.linuxfoundation.org/sites/events/files/slides...

Yeah, I get the impression Linus fucking hates GCC :P

That's good though. Compiler freedom is better for everyone.

The C ABI is de facto standardized, the compiler in use doesn't matter. Rust code can expose a C ABI and be compiled into a linkable artifact, and that means that C code can use it as though it were an artifact compiled by any C compiler.
It's not quite plug-and-play, but it does seem like there's been some progress.

https://lwn.net/Articles/644681/