Loading...

📰 Source: upgoat.net | Upgoat

✍️ Original author: SithEmpire

⬆️ score: 16


v/C · by u/SithEmpire

📝 Original content:

https://fil-c.org/

It’s based on Clang, which is probably second only to GCC for popularity, although with the limitation of only targeting 64-bit Linux at present. That said, it could be used on Linux to detect and fix memory misuse in cross-platform code compiled later for Windows.

This takes a massive dump on the only USP those Rust commies purport to offer. Unlike Rust, which has an “unsafe” keyword for admitting defeat (and every useful program uses it or links a library which uses it), Fil-C tracks all pointers, references and object lifetimes in existing C/C++ code, audits what the program actually does, and reports memory misuse as a compile error.

All common Linux utilities compile correctly using Fil-C without any source changes, as does a large amount of common user software, including desktop environments - enough that it can produce an entirely memory-safe Linux OS. Obviously some projects would need memory fixes (or to run unsafely), but that’s really the point - rewrites cause more problems than they solve, meanwhile running it through a memory-conscious compiler and fixing it in-place is the correct and efficient approach.

Separately to memory safety, it also prevents memory leaks at runtime. This is actually the main concern for me, where I’d prefer to choose what happens (for debug purposes) or disable it (for performance purposes). That way, one could test using a build which reports memory leaks, get those fixed, then rebuild without it (using another compiler, or cross-compile for Windows or mobile).

This post was automatically imported by OratioRepostBot.