Live data from Hacker News

Rust to C compiler – 95.9% test pass rate, odd platforms

fractalfir.github.io

121–130 of 264 posts

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#121

Earlier quoted context omitted.

> to allow me to bootstrap Rust on alpha, hppa, m68k and sh4 Do you actually use all four of those platforms, or is this an arbitrary threshold for what you consider a complete set of platform support?

They're still common (except for alpha) platforms in some market segment specific corners of embedded development. So, maybe for those purposes? Though, the trend I'm seeing a lot of is greenfield projects just migrating their MCUs to ARM.

> Though, the trend I'm seeing a lot of is greenfield projects just migrating their MCUs to ARM.

That’s what I would expect, too.

The Venn diagram of projects using an old architecture like alpha but also wanting to adopt a new programming language is nearly two separate circles.

The parent comment even included HPPA (PA-RISC) which almost makes me think they’re into either retro computing or they have some arbitrary completionist goal of covering all platforms.

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#122

Earlier quoted context omitted.

People may learn from material that uses C for illustration purposes, but that won’t prompt them to write their own C. And don’t even mention ecosystem support in C/C++ where developers are notorious for reimplementing everything on their own because there is no package manager.

"rust import csv-parser" "you've installed 89 packages" why is my executable 20 mb, not as performant as a 50 kb C file & doesn't build a year later if I try to build with 89 new versions of those packages obligatory xkcd reference: https://imgs.xkcd.com/comics/dependency_2x.png this is what package managers lead to

You are greatly exaggerating the numbers, and Rust and its ecosystem are known for being stable. Are you saying everyone should write their own csv parser? Also it’s highly likely that an existing CSV library would be optimized, unlike whatever you wrote ad-hoc, so your performance argument doesn’t hold.

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#123

Earlier quoted context omitted.

"rust import csv-parser" "you've installed 89 packages" why is my executable 20 mb, not as performant as a 50 kb C file & doesn't build a year later if I try to build with 89 new versions of those packages obligatory xkcd reference: https://imgs.xkcd.com/comics/dependency_2x.png this is what package managers lead to

You are greatly exaggerating the numbers, and Rust and its ecosystem are known for being stable. Are you saying everyone should write their own csv parser? Also it’s highly likely that an existing CSV library would be optimized, unlike whatever you wrote ad-hoc, so your performance argument doesn’t hold.

I'm saying package managers automate dependency hell and software is and will be less stable & more bloated as a consequence. And one should know how to write a csv parser and yes, even consider writing one if there are obvious custom restraints and it's an important part of one's project.

(and yes, numbers were exaggerated; I picked something trivial like a csv parser pulling in 89 packages for effect; the underlying principle sadly holds true)

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#125
post #74

I am still waiting for any of the alternative Rust front- or backends to allow me to bootstrap Rust on alpha, hppa, m68k and sh4 which are still lacking Rust support. Originally, the rustc_codegen_gcc project made this promise but never fulfilled it.

rust still doesn't even support OpenBSD on x86_64...

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#126
post #48

Earlier quoted context omitted.

Why wouldn't it?

It could fail if the generated C code triggered Undefined Behavior. For example, signed overflow is UB in C, but defined in Rust. Generated code can't simply use the + operator. C has type-based alias analysis that makes some type casts illegal. Rust handles alias analysis through borrowing, so it's more forgiving about type casts. Rust has an UnsafeCell wrapper type for hacks that break the safe memory model and wou…

> It could fail if the generated C code triggered Undefined Behavior.

> For example, signed overflow is UB in C, but defined in Rust. Generated code can't simply use the + operator.

Obviously, yes, but it could generate overflow checks.

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#127

Earlier quoted context omitted.

I'd like to write Rust, receive its safety benefits (esp borrow checker), compiler to equivalent C, and then use C's tooling on the result. Why use C's tooling? In verification, C has piles of static analyzers, dynamic analyzers, test generators (eg KLEE), code generators (eg for parsing), a prover (Frama-C), and a certified compiler. If using a subset of these, C code can be made more secure than Rust code with more…

Rust is much easier to learn due to C/C++ books all being paid (even cmake wants you to buy their book) whereas Rust documentation is free. I bet more and more people are choosing to learn Rust over C/C++ for this reason, and the number of C/C++ devs will be decreasing.

Probably not. Many people prefer C/C++ to Rust, which has its own fair share of problems.

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#128

Earlier quoted context omitted.

Not GP, but what is the point of touching Rust at all then?

I'd like to write Rust, receive its safety benefits (esp borrow checker), compiler to equivalent C, and then use C's tooling on the result. Why use C's tooling? In verification, C has piles of static analyzers, dynamic analyzers, test generators (eg KLEE), code generators (eg for parsing), a prover (Frama-C), and a certified compiler. If using a subset of these, C code can be made more secure than Rust code with more…

I think we will get the same safety benefits of Rust in a version of C relatively soon.

Re: Rust to C compiler – 95.9% test pass rate, odd platforms

#129

Earlier quoted context omitted.

People may learn from material that uses C for illustration purposes, but that won’t prompt them to write their own C. And don’t even mention ecosystem support in C/C++ where developers are notorious for reimplementing everything on their own because there is no package manager.

"rust import csv-parser" "you've installed 89 packages" why is my executable 20 mb, not as performant as a 50 kb C file & doesn't build a year later if I try to build with 89 new versions of those packages obligatory xkcd reference: https://imgs.xkcd.com/comics/dependency_2x.png this is what package managers lead to

Conversely, "why does my hand-written CSV parser only support one of the 423 known variants of CSV, and it isn't the one our customer sent us yesterday?"

You kind of have a point behind dependency hell, but the flip side is that one needn't become an expert on universal CSV parsing just to have a prayer of opening them successfully.

Post reply on HN