News for hackers. Stuff that matters.
Re:C for All by kerkeslager on Friday March 23, 2018 @11:50AM (#16659287)
What makes you think that a safer C variant would win the hearts of UNIX kernels and embedded devs any more than C++ (which started as just a C variant).
Re:C for All by pjmlp on Friday March 23, 2018 @12:47PM (#16659994)
Because most UNIX kernel devs are religiously against the idea of ever touching C++, even if their beloved C compilers are implemented in C++.
Re:C for All by pcwalton on Friday March 23, 2018 @02:17PM (#16661053)
I highly suspect it's not that Unix C diehards are against the idea of touching C++—it's that they're against the idea of using anything but C. I don't think anything can win over those kernel developers.
Re:C for All by nwmcsween on Friday March 23, 2018 @03:30PM (#16661805)
Its the complexity of the language vs the benefits it provides. C has many pitfalls (UB) but its simple. IMO a language that could migrate C programmers would have dependent types and an effect system with a nice syntax.
Re:C for All by noam87 on Friday March 23, 2018 @11:10PM (#16664585)
Idris?

It can compile small enough to run on an Arduino: https://github.com/stepcut/idris-blink

Re:C for All by pjmlp on Friday March 23, 2018 @03:10PM (#16661591)
Yep you are quite right.

Other OSes not tied to UNIX culture were always more open to reach out for C++, even if constrained to a certain subset.

Re:C for All by int0x80 on Friday March 23, 2018 @03:00PM (#16661492)
Using a compiler partially written in c++ is very different from writting and mantaining a kernel (or whatever) in c++.
Re:C for All by nickpsecurity on Friday March 23, 2018 @06:59PM (#16663395)
Maybe. The L4 people did write one of theirs in C++. L4-style kernrls are among the fastest in existence. Some even fit in the L1 cache of the CPU.

http://www.l4ka.org/projects/pistachio/pistachio-whitepaper....

I can see your point if you're saying compiler use lets them avoid a language they just dont want to use. Which they couldnt if using it for an OS.

Re:C for All by pjmlp on Friday March 23, 2018 @03:07PM (#16661562)
Other OSes, not impregnated with UNIX culture, have a different view on C++'s use on kernel space.

OS X and its descendents is the only exception.

Which goes back to NeXTSTEP using Objective-C and offering UNIX compatibility only as a path to bring software into the system, battling against SGI and Sun market space.

Re:C for All by mrpippy on Friday March 23, 2018 @04:47PM (#16662503)
Even OS X's C++ usage is kind of a historical oddity. OPENSTEP drivers were written in ObjC for an API called DriverKit, but OS X/Darwin/xnu replaced that with the C++ IOKit. The rest of the kernel is still C. I wrote a comment a few years ago explaining why I think that decision was made:

https://news.ycombinator.com/item?id=10006411

Re:C for All by pjmlp on Friday March 23, 2018 @05:48PM (#16662872)
Thanks for the hint.
Re:C for All by BoorishBears on Friday March 23, 2018 @11:54AM (#16659334)
Simplicity, no STL or templating, no OOP connotations

I don’t necessarily think it would, but if it did, those would all be reasons

Re:C for All by BruceIV on Friday March 23, 2018 @12:12PM (#16659554)
[actually on the Cforall team] This is basically our pitch -- the last 30 years of language design features applied to a language that is not only source-compatible with C (like C++), but actually maintains the procedural paradigm of C (unlike C++) -- idiomatic C code should require minimal to no change to make it idiomatic Cforall code, and skilled C programmers should be able to learn the extension features orthogonally, rather than needing to figure out complex interactions between, say, templates and class inheritance. We are working in the same space as C++, and do draw inspiration from C++ where useful, but with the benefit of decades of watching C++ try things to see where the important features are.

There's also some really neat language-level concurrency support; work is ongoing on new features and a shorter summary, but you can see one of our Master's student theses for details: https://uwspace.uwaterloo.ca/handle/10012/12888

Re:C for All by aidenn0 on Friday March 23, 2018 @02:32PM (#16661219)
the existence of exceptions seems to bely the idea of minimal changes to make idiomatic C code idiomatic Cforall code.

While C does have longjmp and friends, usage of them is hardly idiomatic, so most C code assumes no non-local tranfer of control happens when calling functions. Coding with non-local transfer of control and without require very different idioms.

Re:C for All by wolfgke on Friday March 23, 2018 @11:54AM (#16659335)
It would probably be much smaller than the gigantic C++ standard.
Re:C for All by kerkeslager on Friday March 23, 2018 @03:39PM (#16661887)
Okay, so the creators of this safer C promising that it isn't going to grow to the same size as C++? I guess if they're promising that, that makes sense.

C++ was a C variant once.

Re:C for All by emilfihlman on Friday March 23, 2018 @12:05PM (#16659489)
Because it's not C++, it's C.

It doesn't require them/us to change much, just add these flags and the compiler will warn you about things that are unsafe.

I've always found it quite sad that no one is interested in bettering C enough to push relevant changes through.

Re:C for All by pjmlp on Friday March 23, 2018 @12:45PM (#16659966)
Because there is this myth that any good programmer is able to write safe C.

Only newbies make memory corruption errors.

Yet even Dennis acknowledged correct code mattered, and Johnson created lint in 1979!

Largely ignored until clang and its analyzers came into the scene.