*(*int)(nil) = 0我注意到函数中有一行throw
//go:nosplit
func throw(s string) {
// Everything throw does should be recursively nosplit so it
// can be called even when it's unsafe to grow the stack.
systemstack(func() {
print("fatal error: ", s, "\n")
})
gp := getg()
if gp.m.throwing == 0 {
gp.m.throwing = 1
}
fatalthrow()
*(*int)(nil) = 0 // not reached
}
是什么*(*int)(nil) = 0意思?既然这条线*(*int)(nil) = 0无法到达,为什么它在这里?有什么特别的用法吗?
杨__羊羊
相关分类