func overFlowTest() {
maxInt32 := math.MaxInt32
overflowedValue := maxInt32 + 1
fmt.Println("Max Int32:", maxInt32)
fmt.Println("Overflowed Value:", overflowedValue)
fmt.Printf("Type of overflowedValue is %T\n", overflowedValue)
}
结果如下:
最大整数32:2147483647
溢出值:2147483648
overflowedValue的类型为int
当我try MaxInt64时,它溢出.这是否意味着当int32溢出时,它将自动转换为int64?