title: Handling error checking with assert
body: <p>I've looked all over and it seems that there are a lot of mixed views on assert. For example, if I'm malloc'ing a pointer and want to make sure it's been allocated correctly I'd write:</p>
  
  <pre><code>p = malloc(sizeof(int));
  assert(p)
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>p = malloc(sizeof(int));
  if (p == NULL)
  {
  ... send error message
  }
  </code></pre>
  
  <p>I know that with assert it will end the program, but for testing purposes — what I want to know is what the absolute safest way of:</p>
  
  <ol>
  <li>testing for things like a <code>malloc</code> being done correctly.</li>
  <li>dealing with an error if something isn't <code>malloc</code>'d correctly. </li>
  </ol>