News for hackers. Stuff that matters.
Re:The Safe C Library (2009) by cvwright on Wednesday April 12, 2017 @09:49PM (#14103445)
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/

[2] http://safecode.cs.illinois.edu/index.html

[3] http://libcello.org/learn/a-fat-pointer-library

Re:The Safe C Library (2009) by duneroadrunner on Wednesday April 12, 2017 @11:48PM (#14104015)
And 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

[2] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus

Re:The Safe C Library (2009) by sametmax on Thursday April 13, 2017 @01:45AM (#14104429)
> 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.

Re:The Safe C Library (2009) by AstralStorm on Thursday April 13, 2017 @07:01AM (#14105778)
Converting 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.
Re:The Safe C Library (2009) by sametmax on Thursday April 13, 2017 @03:22PM (#14110137)
Rust can be compiled to be called from C too.