News for hackers. Stuff that matters.
Re:The Heartbleed Bug by profquail on Monday April 07, 2014 @08:35PM (#7550669)
Why not write the code in C# (for example) and extract it to $SYSTEM_PROGRAMMING_LANGUAGE? It wouldn't be much different than what Xamarin are doing now for creating iOS and Android apps with C#.
Re:The Heartbleed Bug by pbsd on Monday April 07, 2014 @08:55PM (#7550746)
Using C as an output language, backed by guarantees at the higher level, could certainly work. I believe ATS [1] works this way, and can even avoid garbage collection altogether if desired. I understand it is not an easy language, though.

Nimrod [2] also generates C, but as I understand it garbage collection is unavoidable.

[1] http://www.ats-lang.org/

[2] http://nimrod-lang.org/

Re:The Heartbleed Bug by comex on Monday April 07, 2014 @10:16PM (#7551058)
This is one reason I'd like to see the removed LLVM C backend brought back and modernized, with Rust as the source language. Rust is safe, has no mandatory garbage collector, and has a much lower impedance mismatch with C or C++ than most higher level languages, so it should work well for libraries that are expected to integrate with C code.
Re:The Heartbleed Bug by andrewaylett on Tuesday April 08, 2014 @02:52AM (#7551817)
I'm not clear why you'd want to compile your rust down to C, only to then compile that C again? Surely you're better off with a single compiler invocation, and taking rust straight to object code?

I know that historically it's been easier to write a code generator than a compiler backend, but with LLVM you get the backend just as cheaply as the code gen.

Re:The Heartbleed Bug by lmb on Tuesday April 08, 2014 @08:02AM (#7552799)
Makes it easier to target embedded arches. For example, LLVM doesn't target the MSP430 from TI, but there is a gcc fork for it. Sure, you can write a new backend for LLVM, but that's a whole different ballgame.

This way it would be Rust -> LLVM IR -> C -> GCC for MSP430.

Re:The Heartbleed Bug by stormbrew on Monday April 07, 2014 @10:45PM (#7551161)
> removed LLVM C backend

What are you referring to here?

Re:The Heartbleed Bug by Athas on Tuesday April 08, 2014 @01:57AM (#7551647)
LLVM used to have a backend that could convert its low-level bitcode to portable C.
Re:The Heartbleed Bug by est on Monday April 07, 2014 @08:51PM (#7550725)
Because if you write that in C#, you have to bundle 54MB common runtime and GC withit.
Re:The Heartbleed Bug by profquail on Tuesday April 08, 2014 @09:38AM (#7553283)
Did you actually read my entire comment, or did you just see "C#" and post a knee-jerk reaction? If you extract code from C# to C, you don't need a GC or any of the .NET class libraries -- you'd just have a standalone C file to use like any other.
Re:The Heartbleed Bug by est on Tuesday April 08, 2014 @08:42PM (#7557034)
> If you extract code from C# to C, you don't need a GC or any of the .NET class libraries

The problem is, you do need them. There's no 1:1 C# -> C extraction. You have to extract at least some part of the CLR along with.

Re:The Heartbleed Bug by scott_s on Wednesday April 09, 2014 @10:41AM (#7559546)
Perhaps another way of saying this is that you will always need a runtime. And if you reimplement the portions of the runtime that you need in C, you've essentially re-implemented .NET.