News for hackers. Stuff that matters.
Re:Everything in C is undefined behavior by jstimpfle on Friday May 22, 2026 @04:51AM (#48233502)
> It didn't assume in that case either. It did a well defined thing: add checks.

It did. The compiler added the checks (which panic on overflow, from a quick web search) precisely so it (and importantly, the developer!) can assume the overflow didn't happen in the subsequent code. Unless you consider a panic a defined state, and consider wrap-on-overflow equally valid in all cases, it's essentially the same as UB. (panic seems to be considered "unrecoverable").

Difference is _at most_ that C spec gives compiler more freedom to "implement UB", but then again, hit any unsafe code in Rust with wrapped around integer, you probably have comparable practical result -- machine doing random things, corrupting memory and so on.

Re:Everything in C is undefined behavior by steveklabnik on Friday May 22, 2026 @09:35AM (#48235656)
Okay, I am going to leave this here, as it’s clear to me that we’re not coming to an understanding.