3 ms·
https://odin-lang.org/docs/overview/#integer-overflow https://odin-lang.org/docs/overview/#integer-overflow > For signed integers, the operations +, -, *, /, a
by leecommamichael 3mo ago
https://odin-lang.org/docs/overview/#integer-overflow https://odin-lang.org/docs/overview/#integer-overflow
> For signed integers, the operations +, -, *, /, and << may legally overflow and the resulting value exists and is deterministically defined by the signed integer representation. Overflow does not cause a runtime panic. A compiler may not optimize code under the assumption that overflow does not occur. For instance, x < x+1 may not be assumed to be always true.
- tialaramex 3mo agoYou've linked Odin's documentation. It's good to have documentation, but, because Matt Godbolt is a nice guy we can just try it out and see for ourselves https://odin.godbolt.org/z/4WezGr7nK https://odin.godbolt.org/z/4WezGr7nK In Odin, Dividing the 16-bit signed integer -32768 by -1 results in taking SIGFPE. Maybe it's not documented to do that, but that's what happens.