IssueRaiser

I frankly find the situation around UB puzzling.

I frankly find the situation around UB puzzling. AFAICT the idea was born in the times of very anemic compilers which would translate things that don't make definite sense, or work unpredictably on certain architectures. But why is it still a thing now, 50 years later? If a compiler can detect UB, I think the only reasonable way for it is to have the program terminate immediately, not release "nasal demons". (And, of course, many bugs get smashed against the -Wall which should be the default.) Of course, not all UB can be detected at compile time, like reading the padding bytes in a struct mentioned in the article. I wish there was a way to opt out of all UB, in an arbitrary but predictable way (an immediate crash would be fine), something like -fsanitize but for any UB at all that might happen at runtime. In quite some important code, I'd agree to tolerate the performance hit, it may be cheaper than dealing with the aftermath or an RCE exploited. I see that it's not entirely realistic though.

Posted by nine_k on Oct 9, 2026, 6:26 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

reliability (EdTech)

I frankly find the situation around UB puzzling.

nine_kOct 9, 2026, 6:26 AM

I frankly find the situation around UB puzzling. AFAICT the idea was born in the times of very anemic compilers which would translate things that don't make definite sense, or work unpredictably on certain architectures. But why is it still a thing now, 50 years later? If a compiler can detect UB, I think the only reasonable way for it is to have the program terminate immediately, not release "nasal demons". (And, of course, many bugs get smashed against the -Wall which should be the default.) Of course, not all UB can be detected at compile time, like reading the padding bytes in a struct mentioned in the article. I wish there was a way to opt out of all UB, in an arbitrary but predictable way (an immediate crash would be fine), something like -fsanitize but for any UB at all that might happen at runtime. In quite some important code, I'd agree to tolerate the performance hit, it may be cheaper than dealing with the aftermath or an RCE exploited. I see that it's not entirely realistic though.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue