News for hackers. Stuff that matters.
Re:The long goodbye to C by Santosh83 on Friday November 10, 2017 @11:52AM (#15671127)
> Am I predicting the imminent extinction of C? No. For the foreseeable future I think it will retain a pretty firm grip on OS kernels and device firmware. There, the old imperative to squeeze out maximum performance even if it means using an unsafe language still has force.

Rust is well suited for OS code if not for the inertia that most OS devs are experts at C and not so in Rust and compiler support. Those two factors are going to become less important going forward, so Rust (with generous 'unsafe') could replace C in its last stronghold too.

Re:The long goodbye to C by muricula on Friday November 10, 2017 @12:37PM (#15671466)
I don’t believe Rust is ready for OS kernels yet. People have written OS kernels but they really stretch the language to do it. For instance, the default heap allocation API panics on failure, which isn’t something I want my kernel to do. There’s work on a new API which doesn’t do this in nightly rust, but they could completely change all that tomorrow.

Additionally, alignment constraints are also really important at that level, but rust doesn’t have a mature way to align structures or arrays.

Rust isn’t ready for this space yet.

Re:The long goodbye to C by steveklabnik on Saturday November 11, 2017 @08:38AM (#15676320)
When you're writing a kernel in Rust, you aren't using the default heap allocation API; you aren't using the allocation API at all. You could then build any sort of allocation strategy you want. You don't need to wait for the new traits, though of course, using them eventually helps with interoperability.

You're certainly right about "mature way" wrt alignment, but it's something that can be worked around until then.

Re:The long goodbye to C by tetromino_ on Tuesday November 14, 2017 @04:40PM (#15699427)
Well, C's default heap allocation API is not suitable for kernel mode either. Compare libc's malloc and the kernel's kmalloc, with the fine-grained control [1] over what kind of allocation to perform.

[1] https://github.com/spotify/linux/blob/master/include/linux/g...