title: Is it good practice to NULL a pointer after deleting it?
body: <p>I'll start out by saying, <strong>use smart pointers and you'll never have to worry about this.</strong></p>
  
  <p>What are the problems with the following code?</p>
  
  <pre><code>Foo * p = new Foo;
  // (use p)
  delete p;
  p = NULL;
  </code></pre>
  
  <p>This was sparked by <a href="https://stackoverflow.com/questions/1930459/c-delete-it-deletes-my-objects-but-i-can-still-access-the-data/1930520#1930520">an answer and comments</a> to another question. One comment from <a href="https://stackoverflow.com/users/69307/neil-butterworth">Neil Butterworth</a> generated a few upvotes:</p>
  
  <blockquote>
    <p>Setting pointers to NULL following delete is not universal good practice in C++. There are times when it is a good thing to do, and times when it is pointless and can hide errors.</p>
  </blockquote>
  
  <p>There are plenty of circumstances where it wouldn't help. But in my experience, it can't hurt. Somebody enlighten me.</p>