News for hackers. Stuff that matters.
Re:The Problem with Friendly C by overgard on Wednesday December 23, 2015 @10:28PM (#10786952)
> What sort of optimisations exactly, and just how significant are they?

Well, if you could remove one instruction per loop on most computers (especially conditionals that could cause a branch mis-prediction), the effect of that in terms of performance is pretty staggering. Instead of thinking of it as an optimization, think of it as a check that doesn't need to be inserted into the code. If you can tell the compiler "I promise I won't overflow this variable", that's a lot less error checking it needs to insert on every iteration.

> I don't believe C should be a language where the compiler does all sorts of high-level optimisation; it should be a straightforward "do what I say" type of language where you get almost exactly what you write

Well, you could just compile with -O0 then. I don't necessarily agree with C on this, but it's pretty clear the community has made the decision to prioritize speed over safety. Nothing wrong with that, but if safety is your priority you should probably look at things other than C. Even if you were to define undefined behavior, it's a spectacularly dangerous language.

Re:The Problem with Friendly C by marcosdumay on Thursday December 24, 2015 @09:43AM (#10788290)
> but if safety is your priority you should probably look at things other than C

And those things are?

C is the low level language we have. Now compiler writers decided it'll work like a high level language, except for all the actual benefits.

We'll probably get usable C compilers that work (in fact, this already started), and some stuff only good for old code.

Re:The Problem with Friendly C by overgard on Thursday December 24, 2015 @10:34AM (#10788450)
Rust or Go are possible alternatives, or Java if it doesn't need to be system level.
Re:The Problem with Friendly C by Senji on Thursday December 24, 2015 @11:11AM (#10788568)
Java for performance critical or realtime things sounds like a feverish dreamed nightmare.
Re:The Problem with Friendly C by dequis on Friday December 25, 2015 @02:30AM (#10790655)
The question was about safety, and java is indeed safe.