News for hackers. Stuff that matters.
Re:C for All by zombieprocesses on Friday March 23, 2018 @11:55AM (#16659349)
> So if one finally manages to get a safer C variant that finally wins the hearts of UNIX kernels and embedded devs

A safer variant wouldn't be C. What makes C great for OS development is that it is just a step above assembly and you as a developer are given tremendous amount of power to do good and evil. C#/Java are programming languages with training wheels and it's great for application development. But for low level coding required for OS, network stacks, databases, etc, you really have to take the training wheels off.

I suppose you can try and make the C type system more stringent, but then it wouldn't be C. And considering they are aiming for backwards compatibility with existing C and its immense code infrastructure, they will have to keep the "flaws" in c for all.

Time would be better spent making the libraries/kernel/etc sturdier but if they can pull it off and win the hearts and minds of OS developers, then so be it.

Also, people have been trying to sideline C for decades. Each attempt has only reinforced C's standing and reminded us why C is so essential for OS development. Anyone remember the ill-fated attempt by Sun with their JVM centered JavaOS?

Re:C for All by xamuel on Friday March 23, 2018 @12:29PM (#16659764)
The only way to make C safe without losing performance would be to accompany your C code with a formal proof that it avoids undefined behavior, and use a compiler which refuses to compile the code if the formal proof doesn't validate.
Re:C for All by saagarjha on Friday March 23, 2018 @03:44PM (#16661941)
Which would be essentially impossible for any language like C.
Re:C for All by nickpsecurity on Saturday March 24, 2018 @12:49AM (#16664933)
KCC is an executable, formal semantics for C that does something like that. Runtime Verification Inc uses it for their bug-hunting tools.

https://github.com/kframework/c-semantics

http://fsl.cs.illinois.edu/pubs/ellison-rosu-2012-popl.pdf

Re:C for All by golergka on Friday March 23, 2018 @11:59AM (#16659395)
A full time C#, can confirm. It's an awesome business logic langauge, but the hot path eventually gets rewritten in a very C-like style, with all Linq, exceptions and allocations thrown out.
Re:C for All by pjmlp on Friday March 23, 2018 @12:53PM (#16660078)
The new 7.x features are going to make it easier.
Re:C for All by golergka on Friday March 23, 2018 @04:42PM (#16662483)
Some of us are still stuck in 3.5
Re:C for All by Thiez on Saturday March 24, 2018 @04:29PM (#16668738)
Can you explain why? I assume those c# programs are used for backend stuff on servers, surely it isn't hard to get a 4.6+ runtime installed?
Re:C for All by golergka on Sunday March 25, 2018 @04:51AM (#16671357)
https://docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html

I can switch to 4.6, but don't want the risk of an experimental feature yet.

Re:C for All by Thiez on Sunday March 25, 2018 @11:29AM (#16672577)
Right, forgot about Unity, that makes sense :)
Re:C for All by pjmlp on Friday March 23, 2018 @12:40PM (#16659918)
Microsoft already proven twice that languages with training wheels can be used for writing OSes.

Google is using languages with training wheels to write core components of Fucshia (TCP/IP stack and file system tools are written in Go), as well as the new Android GPU debugger (also in Go).