Re:Matt Godbolt sold me on Rust by showing me C++
by wffurr on Tuesday May 06, 2025 @02:10PM
(#43908024)
This seems like such an obvious thing to have - where is it? Zig, Odin, etc. all seem much more ambitious.
[ Parent
| on HN ]
Re:Matt Godbolt sold me on Rust by showing me C++
by steveklabnik on Tuesday May 06, 2025 @02:24PM
(#43908123)
There have been attempts over the years. See here, a decade ago: https://blog.regehr.org/archives/1287
> eventually I came to the depressing conclusion that there’s no way to get a group of C experts — even if they are knowledgable, intelligent, and otherwise reasonable — to agree on the Friendly C dialect. There are just too many variations, each with its own set of performance tradeoffs, for consensus to be possible.
Re:Matt Godbolt sold me on Rust by showing me C++
by wffurr on Wednesday May 07, 2025 @08:30AM
(#43914808)
That was fascinating reading and a graveyard of abandoned "better C" dialects: SaferC, Friendly C, Checked C, etc.
Re:Matt Godbolt sold me on Rust by showing me C++
by IshKebab on Tuesday May 06, 2025 @02:45PM
(#43908346)
I think if you are going to fix C's footguns you'll have to change so much you end up with a totally new language anyway, and then why not be ambitious? It costs a lot to learn a new language and people aren't going to bother if the only benefit it brings is things that can sort of mostly be caught with compiler warnings and static analysis.
Re:Matt Godbolt sold me on Rust by showing me C++
by zyedidia on Tuesday May 06, 2025 @02:32PM
(#43908201)
I think the only "C replacement" that is comparable in complexity to C is [Hare](https://harelang.org/), but several shortcomings make it unsuitable as an actual C replacement in many cases (little/no multithreading, no support for macOS/Windows, no LLVM or GCC support, etc.).
Re:Matt Godbolt sold me on Rust by showing me C++
by Zambyte on Tuesday May 06, 2025 @05:01PM
(#43909591)
And why do you think Zig (and Odin, but I'm not really familiar with that one) is not comparable in complexity to C? If you start with C, replace the preprocessor language with the host language, replace undefined behavior with illegal behavior (panics in debug builds), add different pointer types for different types of pointers (single object pointers, many object pointers, fat many object pointers (slices), nullable pointers), and make a few syntactic changes (types go after the names of values in declarations, pointer dereference is a postfix operator, add defer to move expressions like deallocation to the end of the scope) and write a new standard library, you pretty much have Zig.