阅读go源码的疑问

weixin_38055275 2019-09-20 10:52:27
go1.12.1源代码中,/src/runtime/proc.go文件中
func main()函数的最后一段代码如图所示,不明白这么写的目的是什么。。。
...全文
19 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38090823 2019-09-20
  • 打赏
  • 举报
回复
Ian Taylor的回复: “The runtime is a special case in many ways, and this is among the more special parts. This loop exists to catch problems while testing new ports. If that loop is ever reached, something has gone badly wrong: the exit call should have caused the program to exit. We can't assume that panic is working. We can't really assume that anything is working. What we want to do is stop the program. Since exit failed, it's possible that a nil dereference will succeed. If that fails too, we still have to do something, so we just loop. We can't return because this is the main function that started the program; there is nothing to return to.” [链接](https://groups.google.com/forum/#!msg/golang-nuts/FnF3oZeJ7aY/sLz0G3oDAgAJ)
weixin_38101791 2019-09-20
  • 打赏
  • 举报
回复
感谢这位大神的解答,谢谢

435

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧