logoalt Hacker News

elnatroyesterday at 10:30 AM3 repliesview on HN

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?


Replies

u1hcw9nxyesterday at 10:47 AM

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)

show 1 reply
saagarjhayesterday at 11:40 AM

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.

peterfireflyyesterday at 12:19 PM

ubsan.

Doesn't catch all of it.