title: "break;" out of "if" statement?
body: <p>Can you break out of an if statement or is it going to cause crashes? I'm starting to acquaint myself with C, but this seems controversial. The first image is from a book on C
  ("Head First C") and the snippet shows code written by Harvard's CS classes staff. What is actually going on and has it something to do with C standards?</p>
  
  <blockquote>
    <p><strong>breaks don't break if statements.</strong></p>
    
    <p>On January 15, 1990, AT&amp;T's long-distance telephone system crashed, and 60,000 people lost their phone service.  The cause? A developer working on the C code used in the exchanges tried to use a <code>break</code> to break out of an <code>if</code> statement.  But <code>break</code>s don't break out of <code>if</code>s. Instead, the program skipped an entire section of code and introduced a bug that interrupted 70 million phone calls over nine hours.</p>
  </blockquote>
  
  <pre><code>for (size = 0; size &lt; HAY_MAX; size++)
  {
      // wait for hay until EOF
      printf("\nhaystack[%d] = ", size);
      int straw = GetInt();
      if (straw == INT_MAX)
          break;
  
      // add hay to stack
      haystack[size] = straw;
  }
  printf("\n");
  </code></pre>