Live data from Hacker News

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

fractalfir.github.io

131–140 of 264 posts

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

#131

Earlier quoted context omitted.

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 underlyin…

The number of dependencies does not indicate how bloated your app is. Package managers actually reduce bloat because your dependencies can have shared dependencies. The reason C programs may seem lightweight is because their number of dependencies is low, but each dependency is actually super fat, and they tend to link dynamically.

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

#132

Rust to C? Why would someone do that. Just write C.. if you can figure rust out you surely can figure C out and be proficient.

I will read further into the project just off the bat I don’t get the point. Good luck it looks quite extensive :)

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

#133

Rust to C? Why would someone do that. Just write C.. if you can figure rust out you surely can figure C out and be proficient.

Because of the niceties of Rust, combined with the widespread compatibility and architecture support of gcc / C compilers in general?

Rust is a modern language, with package management, streamlined integrated build/testing tools, much less cruft, and lots of high-level features and syntax that people actually like. C is neat but complex codebases benefit from modern languages that help in building robust abstractions while still maintaining the speed of C. Not to mention, of course, the borrow checker and memory safety.

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

#134

Earlier quoted context omitted.

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 underlyin…

Anyone can read a file, split it by newline and split it by comma, but what if values contain newlines or commas? How do you unescape? What about other edge cases? In Rust an existing library would handle all that, and you would also get structure mapping, type coercion, validation etc for free.

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

#135
post #27

Earlier quoted context omitted.

Machine code is generally much safer than C - e.g. it usually lacks undefined behaviour. If you're unsure about how a given piece of machine code behaves, it's usually sufficient to test it empirically.

Not true on RISC-V. That's full of undefined behaviour. But anyway this is kind of off-topic. I think OutOfHere was imagining that this somehow skips the type checking and borrow checking steps which of course it doesn't.

What's all that undefined behavior? Closest I can think of is executing unsupported instructions, but you have to mess up pretty hard for that to happen, and you're not gonna get predictable behavior here anyway (and sane hardware will trap of course; and executing random memory as instructions is effectively UB on any architecture).

(there's a good bit of unpredictable behavior (RVV tail-agnostic elements, specific vsetvl result), but unpredictable behavior includes any multithreading in any architecture and even Rust (among other languages))

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

#136
post #127

Earlier quoted context omitted.

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.

Two people is many people. The general trend I see is that Rust is exploding in adoption.

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

#137

Rust to C? Why would someone do that. Just write C.. if you can figure rust out you surely can figure C out and be proficient.

So you can get the benefits of Rust on platforms that rustc doesn't support. Seems pretty straightforward.

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

#138

Rust to C? Why would someone do that. Just write C.. if you can figure rust out you surely can figure C out and be proficient.

It seems like there's a healthy dose of "because it can be done" in play here, but also because there are a lot of platforms that are not supported by Rust where a Rust-to-C converter that generated standard-enough code could be used to bridge the gap.

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

#139
post #128

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…

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

Borrow checker is not the only feature that makes Rust great though.

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

#140
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...

Do you mean x86 (as in 32bit)? Because I'm fairly sure that there's a Rust package available on x86_64 ( and aarch64, riscv64, sparc64 and powerpc64).
Post reply on HN