title: Why `do { ...; exit(...); } while (0)` in C?
body: <p>As a C newbie I'm having trouble understanding <a href="https://lwn.net/Articles/543509/" rel="nofollow">the following code</a>:</p>
  
  <pre><code>#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \
                             } while (0)
  </code></pre>
  
  <p>I gathered that the reason this function is <code>#define</code>d is to override an existing function, but what is the point of a <code>do ... while(0)</code> loop with an <em>unconditional</em> <code>exit()</code> statement? Is it not possible to write this without the loop construct?</p>