Hacker News new | ask | show | jobs
by f33d5173 728 days ago
That's not why it's ub. It's ub to allow compilers to optimize x*2/2 to just x. If you want overflow, you can use unsigned, which has been defined to follow 2's complement semantics for quite some time.