3 ms·
It's true that the C language is available on more platforms, including more exotic platforms, than Rust, and that will probably remain true for quite a while.
by mwcampbell 6y ago
It's true that the C language is available on more platforms, including more exotic platforms, than Rust, and that will probably remain true for quite a while. But in another sense, Rust tends to be more portable in practice.
Take a random, non-trivial C program or library and try to compile it for something that's not a Unix (edit: or cross-compile it). How hard is it to do? Now, do the same with a random Rust crate. It's probably a lot easier.
I think there are two key differences. First, Rust has a standard build system (Cargo) that is dominant, while there are many competing build systems for C. Second, the Rust standard library was designed much more recently, and covers far more of the functionality in today's platforms than the C standard library does. (For example, contrast Rust's OsStr and Path types with the pain of supporting Unicode filenames on both Unix and Windows in C.)
- camgunz 6y agoI think this is a good point, but I think you're mostly talking about building rather than porting. It's way more likely you'll be able to port something from a popular architecture to an obscure one in C because the lingua franca is C, and shipping an architecture generally means shipping C compiler support for it. I would guess this will slowly change as LLVM gets more backends, but that's pretty hand-wavy. The other option is we move more towards platform monoculture, which is probably more likely? Not sure.
- steveklabnik 6y ago(Another option is a gcc frontend for Rust, which the gcc folks have said that they're not opposed to)
- camgunz 6y agoYeah actually I think this would be a great idea. Surely some defense contractor or aerospace company would fund this work.