<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>bluejekyll</author><text>This is why separating return values from error codes is important.&lt;p&gt;For example, in Rust, you’d never get into this situation, because a decent fork ffi function would immediately convert -1 into a Result carrying an error, and properly check errno. Java and C++ would throw an exception, etc.&lt;p&gt;Thus preventing all sorts of bad behavior up the stack.</text><parent_chain></parent_chain></comment><story><title>Fork() can fail: this is important (2014)</title><url>https://rachelbythebay.com/w/2014/08/19/fork/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>usefulcat</author><text>When I first learned of this behavior, I immediately replaced all calls to fork() with calls to the following throughout our entire codebase:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    int checked_fork() {
        const int pid = fork();
        if (pid &amp;lt; 0) {
            throw std::runtime_error(&amp;quot;fork failed&amp;quot;);
        }
        return pid;
    }&lt;/code&gt;&lt;/pre&gt;</text><parent_chain></parent_chain></comment><story><title>Fork() can fail: this is important (2014)</title><url>https://rachelbythebay.com/w/2014/08/19/fork/</url></story>