logoalt Hacker News

nh2 • today at 4:58 PM • 1 reply • view on HN

Some languages make it significantly easier than C to just forbid integer overflow/underflow entirely.

Given that on modern CPUs, cycles are quite fast, and memory latency is quite high, always-checked integer operations sound like an extremely good idea.


Replies

K0nserv • today at 5:07 PM

Sure, I usually use `overflow-checks = true` in Rust for this reason. However, it is still true that the overflow is not what caused the issue here. In Rust it would've paniced on the out of bounds copy, even with `overflow-checks = false`.