title: Is it still safe to delete nullptr in c++0x?
body: <p>In <code>c++03</code> it is pretty clear that deleting a null pointer has no effect. Indeed, it is explicitly stated in <code>§5.3.5/2</code> that:</p>
  
  <blockquote>
    <p>In either alternative, if the value of the operand of delete is the null pointer the operation has no effect.</p>
  </blockquote>
  
  <p>However, in the current <a href="http://www.open-std.org/jtc1/sc22/WG21/prot/14882fdis/n3291.pdf">draft</a> for <code>c++0x</code> this sentence seems to be missing. In the rest of the draft I could only find sentences stating what happens if the operand of the <em>delete-expression</em> is not the null pointer constant. Is deleting the null pointer still defined in <code>c++0x</code>, and if so, where?</p>
  
  <p><strong>Notes:</strong></p>
  
  <p>There is significant circumstantial evidence to suggest that it is still well defined. </p>
  
  <p>First, there are the two sentences in <code>§5.3.5/2</code> stating that </p>
  
  <blockquote>
    <p>In the first alternative (delete object), the value of the operand of delete may be a null pointer value, ...</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>In the second alternative (delete array), the value of the operand of delete may be a null pointer value or ...</p>
  </blockquote>
  
  <p>These say that the operand is allowed to be null, but on their own do not actually define what happens if it is.</p>
  
  <p>Second, changing the meaning of <code>delete 0</code> is a major breaking change, and the standards committee would be very unlikely make this particular change. Furthermore there is no mention of this being a breaking change in the Compatibility Annex (Annex C) of the <code>c++0x</code> draft. Annex C is however an Informative section, so this has no bearing no the interpretation of the standard.</p>
  
  <p>On the other hand, the fact that deleting the null pointer is required to have no effect implies an additional run-time check. In a lot of code the operand can never be null, so this runtime check is in conflict with the zero overhead principle. Maybe the committee just decided to change the behaviour to bring standard c++ more in line with the stated design goals of the language.</p>