← Back to context

Comment by pornel

7 hours ago

It's not worth it. The value of C is in compatibility, availability of compilers, and familiarity.

As soon as you change anything in a breaking way, start requiring your own compiler/transpiler, or introduce new idioms, you end up losing the things that keep C alive.

Users of C either like it exactly the way it is, or have to use a specific C version due to a vendor dependency or compliance.

An upgraded C not approved by the standards body gives you yet another niche language that is not C, but is still burdened with its old flaws.

Well said.

I really don't understand why people bring up other languages when one is discussing implementation of some "advanced/tricky/hackish/new" features in C. It is not as if the implementer does not know about the ease of availability in other languages but there is always some set of criteria which prevents switching to a new language.

On a related note, there is a dearth of written/learning material (books etc.) cataloging and explaining advanced architecture/design/implementation patterns in C though we know they exist in the tons of industrial-strength codebases out there.

There is also the fact that when you see an implementation in C of some feature from another language you better understand language design pragmatics eg. implementing inheritance and virtual functions in C gives you insight into how they work in C++/Java/C#/etc.

It would be nice to have something like C which was very much like C and Pascal (not the syntax) but which was basically C except no naked pointers by default etc, fewer footguns, but which would generate C.

  • mrustc generates (ugly) C from Rust. And doesn't borrow check or otherwise add any bounds checks. It only supports the parts of Rust that the Rust compiler itself needs, but that's quite a lot of it.