4 ms·
I don't disagree. > If you actually care about memory safety ... then why not use an actual memory-safe language? Many teams are stuck with established codeba
by cvwright 10y ago
I don't disagree.
> If you actually care about memory safety ... then why not use an actual memory-safe language?
Many teams are stuck with established codebases that they can't afford to re-write entirely from scratch.
I think the proposal in the article is an interesting point on a continuum of mitigations for C, spanning from the really weak and/or hacky (but cheap/easy) all the way up to safe systems languages like Rust and Ivory. Other points on this continuum include Cyclone [1], SAFECode [2], and the fat pointer approach in Cello [3].
[1] http://cyclone.thelanguage.org/ http://cyclone.thelanguage.org/
[2] http://safecode.cs.illinois.edu/index.html http://safecode.cs.illinois.edu/index.html
[3] http://libcello.org/learn/a-fat-pointer-library http://libcello.org/learn/a-fat-pointer-library
- duneroadrunner 10y agoAnd don't forget the llvm (and gcc) sanitizers[1] and SaferCPlusPlus[2] (essentially a memory safe subset of C++), which are more modern and have arguably better overall combinations of performance/safety/compatibility/practicality. Automatic translation (assistance) from native C to SaferCPlusPlus is being worked on. And if you'll permit me to gripe a little here - you might think it's a reasonable undertaking, until you start contemplating code like this: int **var1 = (int **)malloc(20); var1[2] = (int *)malloc(10); int *var2 = var1[2] + 4; var2--; free(var2 - 3); free(var1); :) [1] https://github.com/google/sanitizers https://github.com/google/sanitizers [2] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus https://github.com/duneroadrunner/SaferCPlusPlus
- sametmax 10y ago> Many teams are stuck with established codebases that they can't afford to re-write entirely from scratch. You don't have to. Most alternative can call compiled C libraries. Rust can.
- AstralStorm 10y agoConverting a monolithic chunk of code into modules then rewriting it in another language takes a lot of effort with not too much to show for it.
- sametmax 10y agoRust can be compiled to be called from C too.