3 ms·
I'm getting bit annoyed about these sorts whiny posts that float up occasionally. Here is a simple three step program if you don't like what C language is today
by zokier 11y ago
I'm getting bit annoyed about these sorts whiny posts that float up occasionally. Here is a simple three step program if you don't like what C language is today:
1) Write your own damn spec with no "problematic" UB. Hookers and blackjack are optional
2) Write a compiler for your shiny new language.
3) Start writing/porting code to your new language
There you have it, UB problem solved once and for all.
I'm not sold over on Regehrs work, but at least he is doing something with his Friendly-C proposal. This has the added benefit that we get something more concrete to discuss and debate about instead of vague "optimizations breaking my code are bad".
It is completely unfeasible to try to turn back time on C and somehow magically make compilers deduce programmer intent from some random crap that you throw at them. Like it or not, computers are based on rules, and standards are the best way we have to establish those rules among large number of parties.
- Kristine1975 11y agoDesigning your own language isn't even necessary. There's Rust, Ada, Modula, Pascal... if you're feeling masochistic, use COBOL ;-)
- dalke 11y agoThe Wikipedia page for COBOL list several places where programming constructs lead to undefined behavior.
- kbenson 11y agoThe problem is not just with "what C language is today", but with the fact that the use of undefined behavior allows future optimizations to possibly change how your code that was written today, tomorrow, or years ago, compiles and runs in the future.