Live data from Hacker News

C-for-all: Extending C with modern safety and productivity features

cforall.uwaterloo.ca

11–20 of 143 posts

Re: C-for-all: Extending C with modern safety and productivity features

#11
This has been posted here a couple of times in the distant past but for whatever reason I can only find one old post:

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

Anyway, it seemed like an interesting project the last time I looked at it but Rust wound up getting all my attention.

Re: C-for-all: Extending C with modern safety and productivity features

#12
if safety is what they want without departing from C just use MISRA-C

> While C++, like C∀, takes an evolutionary approach to extending C, C++'s complex and interdependent features (e.g., overloading, object oriented, templates) mean idiomatic C++ code is difficult to use from C, and C programmers must expend significant effort learning C++.

the "significant effort" for learning C++ pays off (financially), while this certainly does not.

Re: C-for-all: Extending C with modern safety and productivity features

#13
Obligatory name-drop: Zig is an awesome low level programming language targeting the same space as C and CForAll. It isn't at all compatible with C on the source level like CForAll is, but it does make it super easy to interop with C, because it can include .h files. That means it lets you move projects from C to Zig file-by-file. Because Zig benefits from decades of insights about how C could've been better, it has way fewer footguns and higher productivity.

Obviously CForAll has a learning curve advantage over Zig, being based on C directly, but for any readers not aware, I'd say, also check out Zig.

https://ziglang.org/

Re: C-for-all: Extending C with modern safety and productivity features

#15
post #7

I'm sure a lot of very smart people are working on this, and I don't want to detract from their dedication, but man this language looks like a mess. And in no small part because it wants to be backwards compatible with C (the reasoning is unconvincing -- why not just use C++?). In the age of Go and Rust, which already have a hard time finding niches, I don't really think there's any room for a language like this. And…

I don't know, I work in the games industry and we're currently building a small project that's probably 95% C(the only C++ we have is for one library that has to have a C++ wrapper). It's just.....we don't need the C++ features, the compilation times are instant(last project I worked on was a large AAA game in C++ and compiling it from scratch was about 40-50 minutes on a single workstation), and pretty much all libs are C anyway. I'm not going to make the performance argument since it's mostly irrelevant nowadays, but I just don't see us using C as anything out of ordinary.

Re: C-for-all: Extending C with modern safety and productivity features

#16
post #4

Could someone expand on why Rust "isn't a systems language"?

I think that, in their words, of its "restrictive memory management".

Interesting choice of words given you can do practically everything you can do in C also in (possibly unsafe) Rust.

Re: C-for-all: Extending C with modern safety and productivity features

#17
post #4

Could someone expand on why Rust "isn't a systems language"?

It's simply incorrect, and betrays a carelessness with facts. Now, if you wanted to argue that the fragment of Rust excluding "unsafe" is not a systems language, fine. But by that reasoning, I think you can make an even stronger argument that (standard) C is not a systems programming language, because in practice no kernel is written in a way that avoids all undefined behavior.

Re: C-for-all: Extending C with modern safety and productivity features

#19
post #10
post #6

Linked page explains rationale, see also the list of features : https://cforall.uwaterloo.ca/features/

So this is loading for you?

Yes, some of the many features : Tuples, left to right declaration syntax, references with auto dereferencing, constructors destructors, nested routines, extended case with ranges, choose (switch with no fallthrough), overloading and polymorphism.

Re: C-for-all: Extending C with modern safety and productivity features

#20
I really don’t need an extended-C with productivity features... as that’s one of the defining points of C(the language is small). Fixing the warts (like different behavior between the overflow of unsigned ints & signed inta) would have been fine.

I personally want a better stdlib for C; fix the defiancies of , removing the global locales (changing function behaviors according to LC_* was a really, really bad idea[0]), etc...

Does anyone know of an alternative stdlib for C?

[0] https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...

Post reply on HN