Hacker News new | ask | show | jobs
by moltonel3x 986 days ago
People often point this out, silently implying that Rust is not really supported/usable on the lower tiers and that therefore those platform should stick to C. But that's ignoring that the situation is the same with gcc/clang: niche platforms get much less testing, and very niche ones might have bitrotted without anyone noticing. Gcc doesn't publish or adheres to a tiered platform list, but if it was using Rustc's definition it would be at most tier 2 (because tier 1 distributes official binaries, and prevents any tier1-breaking changes from being merged).
2 comments

Also, GCC also has support for Go, D, Ada, Modula-2, it isn't as if the GCC side isn't without options for safe systems programming.

And in any case, C++ is always a better option than C regarding safety, when nothing else is available.

D, Ada, and Modula don't have enough traction.

Go's runtime can be a showstopper, especially for multi-language projects.

C++ may be better than C, but many people feel that Rust is even better.

Rust is already available in almost all scenarios, there's no need to wait for it.

So now we moved from not having alternatives, to alternatives exist but...
If I'm using a device on one of the lower tiers, it's fair to assume that the C compiler for it has been exercised quite a lot, much more than the shiny new rust compiler that I'm introducing that I have no reason to think anybody else has ever used on this platform.
Curl could be assumed to be one of the most well-exercised code bases in the world, and yet there are still bugs.
Why would you think that nobody has ever used Rust there ? Somebody has obviously put in the work to support that platform, rustc doesn't just blindly inherits the list of target triples from llvm.

While it's safe to assume that C gets a decent amount of use on every platform, you can't expect all platforms to be as well-supported as the major ones. Undoubtedly, some of those platforms would be listed as low-tier if the C compilers cared to maintain a platform tier list. But a platform being low-tier doesn't mean you shouldn't use that compiler there.

As for trusting Rust or C on niche platforms, C is so full of UB, platform-specific choices, and vendor extensions, that it's hard to ever fully know how well this or that project will work. Rust is much less surprising, if it works at all I expect it to fully work. I'd definitely pick Rust on niche platforms if I have the choice.

There actually isn't that much work to adding basic support for a new platform target for Rust. You're moreso banking on LLVM's ability to target it, which, given clang gives you that C compiler maturity you're after.
Likewise for C++, with standard library types having support for bounds checking, no need to wait for Rust.

While not as safe as Rust, it is definitly much safer than plain C.