title: Elegant error checking
body: <p>Our code (in a simple library implementation) is beginning to look like this:</p>
  
  <pre><code>err = callToUnderlyingLibrary1();
  if (err!=0) {
  printf ("blah %d\n", err);
  ...
  }
  
  err = callToUnderlyingLibrary2();
  if (err!=0) {
  printf ("blah %d\n", err);
  ...
  }
  
  err = callToUnderlyingLibrary3();
  if (err!=0) {
  printf ("blah %d\n", err);
  ...
  }
  </code></pre>
  
  <p>This is cumbersome and ugly. Is there a better way to do this ? Perhaps using the C preprocessor ? I was thinking something like:</p>
  
  <pre><code>CHECK callToUnderlyingLibrary1();
  CHECK callToUnderlyingLibrary2();
  CHECK callToUnderlyingLibrary3();
  </code></pre>
  
  <p>where the CHECK macro invokes the function and does the rudimentary error checking.</p>
  
  <p>Are there preferred idiomatic ways of handling this ?</p>