umka-lang
umka-lang copied to clipboard
`int` overflow not detected
fn main() {
var x: int = 9483412322824321334
printf("%v", x) // -8963331750885230282
}
fn main() {
var x: uint = -1
printf("%v", x) // 18446744073709551615
}
fn main() {
x := false ? 0 : 9483412322824321334
printf("%v", x) // -8963331750885230282
}
Can this be detected at compile time? If operations like addition and subtraction e.t.c. are the only means of getting the overflow at runtime.