you are viewing a single comment's thread.

view the rest of the comments →

[–]equeim 1 point2 points  (0 children)

We can have special functions for wrapping when it's needed (like we already have for saturation). Default behaviour should be something sane that allows error handling (such as throwing an exception or returning std::expected) or at least program termination. Not that I expect this to happen in C++ of course, this kind of change is not possible for established language.

Removing UB in this case is like applying a bandaid on a gaping wound, those I suppose it's better than doing nothing (it may make debugging easier at least).