logoalt Hacker News

steveklabniktoday at 1:23 PM1 replyview on HN

It is defined as an error. That error’s default handling is wrapping when debug_assertions is off, and panic when it’s on, but since it’s an incorrect program (though not UB) either behavior is acceptable in any mode.


Replies

jstimpfletoday at 1:53 PM

If it is defined as an error, but the compiled build will continue to run with the value wrapped around, I would say that's indistinguishable from UB.

show 2 replies