Live data from Hacker News

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

fractalfir.github.io

201–210 of 264 posts

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

#201

Earlier quoted context omitted.

what a weird take to me... C has DECADES of high quality teaching material in form of books, university courses, plenty of which is freely available with a bit of searching. And, if we discount the fact that "buying" a book is such a big hurdle, even more high quality academic text books and papers to boost; anything from embedded on the weirdest platforms, basic parsing, writing compilers, language design, high perf…

> edit2: networking, signal processing, automotive, learning about industry protocols and devices of any sort... I admit there is many great products that are written in C that aren’t going anywhere any time soon, notably SQLite, but there is no reason to write new software in C or C++.

There's tools that can prove the absence of runtime errors in industrially-useful subsets of C. Frama-C, RV-Match, and Meta's Infer come to mind. That code is then usable in about anything because so much of it is written in or can call C. Until Rust has that combo, there's still a reason to use C.

Personally, I'd use both Rust and C with equivalent code. The Rust types and borrow checker give some extra assurance that C might not have. The C tooling gives extra assurance Rust doesn't have. Win, win. If I want, I can also do a certified compile or cross-compile of the Rust-equivalent, C code.

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

#203

Earlier quoted context omitted.

> edit2: networking, signal processing, automotive, learning about industry protocols and devices of any sort... I admit there is many great products that are written in C that aren’t going anywhere any time soon, notably SQLite, but there is no reason to write new software in C or C++.

There's tools that can prove the absence of runtime errors in industrially-useful subsets of C. Frama-C, RV-Match, and Meta's Infer come to mind. That code is then usable in about anything because so much of it is written in or can call C. Until Rust has that combo, there's still a reason to use C. Personally, I'd use both Rust and C with equivalent code. The Rust types and borrow checker give some extra assurance th…

I researched and discovered kani https://github.com/model-checking/kani, it's pretty cool.

```rust

#[kani::proof]

fn main() {

    let mut array: [i32; 10] = kani::any();

    array.sort_unstable();

    let index: usize = kani::any_where(|i| *i > 0 && *i = array[index - 1]);
} ```

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

#204
post #171

Earlier quoted context omitted.

Auto as it is now has been in C++ since C++11, thats more than a decade ago... If your argument was C then sure thats a C23 feature (well the type inference type of auto ) and is reasonably new. This is much more a reflection on youe professor than the language. C++11 was a fundamental change to the language, anyone teaching or using C++ in 2025 should have an understanding of how to to program well in a 14 year old…

> Auto as it is now has been in C++ since C++11, thats more than a decade ago... > anyone teaching or using C++ in 2025 should have an understanding of how to to program well in a 14 year old version of said language... If the current year is 2025 then 14 years ago is 2011 which is not that long ago. > If your argument was C then sure thats a C23 feature (well the type inference type of auto ) and is reasonably new.…

Decades ols books in C most certainly is even useful in modern C++23 because you need to interact with other libraries written in C89.

When a lot of modern CS concepts wwre first discovered and studied in the 70s, there's no point arguing that old books are useless. Honestly there may be sections of old books that are useless but in the whole they are still useful.

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

#205
post #204

Earlier quoted context omitted.

> Auto as it is now has been in C++ since C++11, thats more than a decade ago... > anyone teaching or using C++ in 2025 should have an understanding of how to to program well in a 14 year old version of said language... If the current year is 2025 then 14 years ago is 2011 which is not that long ago. > If your argument was C then sure thats a C23 feature (well the type inference type of auto ) and is reasonably new.…

Decades ols books in C most certainly is even useful in modern C++23 because you need to interact with other libraries written in C89. When a lot of modern CS concepts wwre first discovered and studied in the 70s, there's no point arguing that old books are useless. Honestly there may be sections of old books that are useless but in the whole they are still useful.

We're talking about learning C/C++ from scratch which makes no sense to do by using a decades old book because it wouldn't teach you any modern features. Also we're not talking about computer science.

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

#206
post #145

Earlier quoted context omitted.

Right, and that probably should have been the link rather than some in-process thoughts about popcount or w/e. Sorry for not figuring it out and clicking around effectively.

The linked article was mostly meant for people already lossely familiar with the project, but it seems it escaped its intended audience. I do have a whole bunch of articles about the project on my website, going trough the entire journey of the project, from its start as a Rust to .NET compiler, to the current state. https://fractalfir.github.io/generated_html/home.html I should have probably linked the previous arti…

Your positive attitude and the talent is inspiring. Thank you very much!

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

#207
post #176
post #109

Earlier quoted context omitted.

Extremely unlikely. CPU bugs generally halt the CPU or fail to write the result or something like that. The Pentium FDIV bug where it would give a plausible but wrong result was a once in a lifetime thing.

Spectre and Meltdown exploits stopped working, too. Some of them on some CPUs, anyway.

Sure. But those were obviously exploits from the start. You wouldn't write code like that accidentally.

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

#208
post #193

Earlier quoted context omitted.

I know a guy who used to love Rust and his cannot stand it. The hype wore off in his case.

Does he prefer fighting libtool, make, cmake, configure, automake, autoconf and autoreconf just to add a couple libraries into his project? When I tried to use C, I wrote 10 lines of code and spent hours trying to make all that shit work. It makes me laugh when people say Rust is complicated.

It really is not that complicated. You just use -llibrary when linking and it links.

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

#209
post #198
post #109

Earlier quoted context omitted.

Extremely unlikely. CPU bugs generally halt the CPU or fail to write the result or something like that. The Pentium FDIV bug where it would give a plausible but wrong result was a once in a lifetime thing.

Do a web search for rdrand and systemd.

> Do a web search for rdrand and systemd.

RDRAND always returning all-FF is exactly the kind of thing that's an obvious bug, not a plausible-but-wrong result.

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

#210
post #189

Earlier quoted context omitted.

Both C and C++ release new versions. The compilers continue to support the old versions and people continue using the old versions (less so in the case of C++). Rust’s compiler drops the old version every time it has a new release. There is no `-std=1.85` in rust 1.86. You do get `-std=c++98` in both g++ and clang++. A book on C or C++ is still useful even decades later since the version of C or C++ described does no…

I'm confused. Rust uses semantic versioning: Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes MINOR version when you add functionality in a backward compatible manner PATCH version when you make backward compatible bug fixes Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format. What kind of version…

C and C++ are two different languages. They are versioned by years. Rust technically does not have versions. The rust tools have versions. Basically all versions of C are binary compatible with each other. I suggest you actually learn and use C rather than asking questions since you are never going to ask the right things to understand how it works without having firsthand experience.
Post reply on HN