小编lit*_*lec的帖子

为什么 Golang 在 atoi.go 中像这样处理截止?

// code in atoi.go, line 90
var cutoff uint64
switch base {
case 10:
    cutoff = maxUint64/10 + 1
case 16:
    cutoff = maxUint64/16 + 1
default:
    cutoff = maxUint64/uint64(base) + 1
}
Run Code Online (Sandbox Code Playgroud)

我在Golang包的atoi.go文件中看到了一些代码,为什么不像下面这样写呢?

var cutoff = maxUint64/uint64(base) + 1
Run Code Online (Sandbox Code Playgroud)

非常感谢。

overflow atoi go

3
推荐指数
1
解决办法
50
查看次数

标签 统计

atoi ×1

go ×1

overflow ×1