logoalt Hacker News

GeertBlast Thursday at 7:55 PM1 replyview on HN

Signed integer addition is only associative when overflow is defined to wrap around like unsigned arithmetic. This condition is matched here, because only debug builds panic on overflow. However, it's a bit of a gray area that the article completely ignores.


Replies

thrancetoday at 10:27 AM

Unlike C, Rust's signed arithmetic is fully specified to wrap around.

show 2 replies