我注意到函数throw
中有一行*(*int)(nil) = 0
//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
线打不到,为什么会在这里呢?有什么特殊用途吗?