News for hackers. Stuff that matters.
Re:A simplified model of Fil-C by forrestthewoods on Friday April 17, 2026 @07:09PM (#47811560)
Rust also has run-time crash checks in the form of run-time array bounds checks that panic. So let us not pretend that Rust strictly catches everything at compile-time.

It’s true that, assuming all things equal, compile-time checks are better than run-time. I love Rust. But Rust is only practical for a subset of correct programs. Rust is terrible for things like games where Rust simply can not prove at compile-time that usage is correct. And inability to prove correctness does NOT imply incorrectness.

I love Rust. I use it as much as I can. But it’s not the one true solution to all things.

Re:A simplified model of Fil-C by omcnoe on Friday April 17, 2026 @07:37PM (#47811776)
Not trying to be a Rust advocate and I actually don't work in it personally.

But Rust provides both checked alternatives to indexed reads/writes (compile time safe returning Option<_>), and an exception recovery mechanism for out-of-bounds unsafe read/write. Fil-C only has one choice which is "crash immediately".

Re:A simplified model of Fil-C by uecker on Friday April 17, 2026 @08:28PM (#47812063)
What makes you think that one can not add an explicit bound check in C?
Re:A simplified model of Fil-C by tialaramex on Friday April 17, 2026 @08:41PM (#47812149)
It's trickier than it looks because C has mutable aliases. So, in C our bounds check might itself be a data race! Make sure you cope
Re:A simplified model of Fil-C by uecker on Friday April 17, 2026 @09:35PM (#47812436)
Depending on what you are doing, yes. But the statement I responded to "your only choice is crash" is certainly wrong.
Re:A simplified model of Fil-C by jstimpfle on Sunday April 19, 2026 @09:03AM (#47824009)
Bounds checks have nothing to do with data races. GP is right, you can add bounds checks. Either using macros or (in C++) with templates and operator overloading.
Re:A simplified model of Fil-C by tialaramex on Wednesday April 22, 2026 @11:51AM (#47865390)
Alas, in C or C++ you have mutable aliasing, so I'm afraid you do incur a potential data race because your bounds might alias. Be careful out there.

Also remember that in C++ you may get a reference in these cases and if you keep that reference rather than using it immediately now you also have a potential TOCTOU race because the reference was only valid when you did the bounds check.

Re:A simplified model of Fil-C by jstimpfle on Thursday April 23, 2026 @11:04AM (#47876588)
True, but you do incur potential data races _everywhere_. There's no relation to bounds checking specifically.
Re:A simplified model of Fil-C by tialaramex on Friday April 24, 2026 @11:42AM (#47891788)
Ah, maybe I should have made the example clearer

With mutable aliasing the length might change even though the data you care about did not, and so adding the check means incurring a race which did not previously exist and which certainly the naive C programmer cannot see...

We can definitely mitigate this in the type system for most real world scenarios, but you don't mitigate problems you don't know about, so knowing is what's important.

Re:A simplified model of Fil-C by omcnoe on Friday April 17, 2026 @08:35PM (#47812115)
If you can correctly add all the required explicit bounds checks in C what do you need Fil-C for?
Re:A simplified model of Fil-C by kimixa on Friday April 17, 2026 @09:43PM (#47812475)
Same reason any turing complete language needs any constructs - to help the programmer and identify/block "unsafe" constructs.

Programming languages have always been more about what they don't let you do rather than what they do - and where that lies on the spectrum of blocking "Possibly Valid" constructs vs "Possibly Invalid".

Re:A simplified model of Fil-C by uecker on Friday April 17, 2026 @09:25PM (#47812394)
For temporal memory safety.
Re:A simplified model of Fil-C by wakawaka28 on Friday April 17, 2026 @07:39PM (#47811794)
>And inability to prove correctness does NOT imply incorrectness.

And inability to prove incorrectness does NOT imply correctness. I think most Rust users don't understand either, because of the hype.