TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Infinite loop after exit(0)

3 点作者 nazri1将近 8 年前

1 comment

nazri1将近 8 年前
Fo those who didn&#x27;t read the linked thread, here&#x27;s the nugget (answered by Ian Lance Taylor):<p><pre><code> &gt; Why not just panic, though? And why the infinite loop, I wonder? 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&#x27;t assume that panic is working. We can&#x27;t really assume that anything is working. What we want to do is stop the program. Since exit failed, it&#x27;s possible that a nil dereference will succeed. If that fails too, we still have to do something, so we just loop. We can&#x27;t return because this is the main function that started the program; there is nothing to return to.</code></pre>
评论 #14587481 未加载