3 ms·
Making C compilers better and more predictable is impossible with so many UB cases listed in the standard. A better language should be used instead, where UB an
by Panzerschrek 8mo ago
Making C compilers better and more predictable is impossible with so many UB cases listed in the standard. A better language should be used instead, where UB and implementation-defined behavior cases are minimized.
- dotancohen 8mo agoHave you seen Rust? I'm loving it.
- uecker 8mo agoRust is not super appealing to me as C user: too complex, slow compilation, etc.
- mfru 8mo agoMaybe Zig, Hare or C3 then?
- uecker 8mo agoAlso what I like about C is that is has mature tooling, very portable with multiple implementations, and that is is very stable. I would not use a language for any serious project hat does not offer all this. Honestly, I do not think that the problem is C is o big that one needs to jump ship. There are real issues, yes, but there are also plenty of good tools and strategies to deal with UB, it is not really an issue for me.
- Panzerschrek 8mo agoZig isn't a language I mean. It's still full of footguns. It doesn't address fundamental reliability issues of C.
- mfru 8mo agoI was responding to uecker, who had other preferences
- dotancohen 8mo agoYou are correct about the complexity. I write it with significant assistance from an LLM. Not quite vibe coding, but close. But I'm coming from Python, not C.
- Panzerschrek 8mo agoSlow compilation and complexity isn't an issue. It's a price for much better result code quality and elimination of many errors.
- uecker 8mo agoWhere there is UB in the standard it means that a C compiler is free to define the behavior. So of course, somebody could write a C implementation which does this. See also Fil-C for a perfectly memory safe version of C. So the first sentence makes no sense. But also note that there is an ongoing effort to remove UB from the standard. We have eliminated already about 30% of UB in the core language for the upcoming version C2Y.
- Panzerschrek 8mo agoC is designed in such a way, that designing a safe compiler without big performance penalties isn't possible. How much Fil-C is slower compared to something like GCC? 2 to 5 times slower?
- uecker 8mo agoThis is only relevant for specific types of UB, and even there it is not entirely clear. One of the main challenges is ABI compatibility and separate compilation. Both are not necessarily part of the "design of C". If you are willing to give this up, a lot can be done. Annotations are another possibility to get full memory safety without performance cost.