|
|
Subscribe / Log in / New account

Rust support hits linux-next

Rust support hits linux-next

Posted Apr 27, 2021 14:25 UTC (Tue) by nix (subscriber, #2304)
In reply to: Rust support hits linux-next by Wol
Parent article: Rust support hits linux-next

> I gather Rust has been designed as a low-level language, and as such is currently much better than C, which has steadily been acreting hi-level features.

That's a fairly ridiculous characterization. By any standard, Rust is much higher-level than C: you name it, language-wise it has way more advanced features and permits a higher level of abstraction than C does. What it also has is more consistency (fewer implementation-defined edge cases).


to post comments

Rust support hits linux-next

Posted Apr 27, 2021 16:21 UTC (Tue) by Wol (subscriber, #4433) [Link] (1 responses)

But does it also provide more control over the machine code that's generated?

I've come to the conclusion that a good low-level language "does not give the compiler much opportunity to optimise well-written code". It seems most problems with C (for the kernel at least) are caused by the compiler optimising the hell out of it.

So long as high-level constructs map cleanly to the obvious underlying machine/assembler code, I'd call that a "good low-level language".

Cheers,
Wol

Rust support hits linux-next

Posted Apr 27, 2021 17:01 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

Depends on who you ask I guess. Is it "clear" when a chain of iterator calls are fused into a single loop over the input? Is it "clear" when tail call optimization is applied? I couldn't tell you what instructions any given line compile down to in Rust or C myself anyways, so for me none of it is "clear" anyways.

That said, I don't know Rust's guarantees around reordering statements, but given the more explicit "I'm using a single variable across threads" model, there are likely a lot fewer ways the compiler can think to order things (barring bugs in the compiler, but that's C's problem too).


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds