Hacker News new | ask | show | jobs
by UncleMeat 53 days ago
A challenge is that it doesn't seem like people agree on what "surprising" UB is. I don't think it would be totally unreasonable to have a compiler mode that specifically assumes that all arithmetic operations are total functions, which covers many of the scenarios that show up in blog posts. But there is somebody in this comment thread who is upset that you can't read from an uninitialized heap address to obtain unpredictable data.

My personal observation is also that it only surprises developers when they read blog posts about it and that this actually comes up quite rarely in practice.