News for hackers. Stuff that matters.
Re:Checked C by tialaramex on Wednesday December 21, 2022 @04:31PM (#34086658)
You get a lot more in core (and thus no-std) than the free standing C language.

For example C's qsort lives in the standard library, whereas in Rust although [].sort() needs alloc, the [].sort_unstable() is a core feature!

str::split_once(['5', '7']) will split a string at the first digit 5 or 7... You need considerable work to do that in C, and doing it modifies the string. In Rust it's a core feature.

Of course Rust is relying on the fact that none of the machine code is emitted unless you use these features, indeed split_once is fully generic, the types used only come into existence because you called the function. So presumably this was not practical as the fundamental language for writing Unix fifty years ago.

There are no comments on this comment yet.