|
|
|
|
|
by c4mpute
1171 days ago
|
|
> all you have to do to avoid UB on signed integer overflow is check for overflow before doing the operation All you have to do is add a check for overflow _that the compiler will not throw away because "UB won't happen"_. The very thing you want to avoid makes avoiding it very hard, and lots of bugs have resulted from compilers "optimizing" away such overflow checks. |
|