Comment by elnatro
7 hours ago
Is there a way to avoid undefined behavior Im C then? Could we write a new C compiler that adds some checks and fixes (e.g. raise documented exceptions) to each undefined behavior?
7 hours ago
Is there a way to avoid undefined behavior Im C then? Could we write a new C compiler that adds some checks and fixes (e.g. raise documented exceptions) to each undefined behavior?
That post is just a hyperbolic rhetorical piece, not even a good technical shade. There are plenty of tools that restrict C into defined behavior subset. HN is just not aware of them. NASA, Aerospace and car industry are big customers, static analyzers and compilers.
Good open source ones:
Frama-C
IKOS (from NASA)
It’s been a while since I programmed in C. Thank you for these resources.
Not all of them but there are many tools that can try to define behavior for this code to help shake them out of your codebase.
ubsan.
Doesn't catch all of it.