Removal of zero indicator



  • What happens when you try to remove a zero indicator through delete?



  • It's nothing.


    Formal reference https://ru.stackoverflow.com/q/417797/10105 §5.3.5/2:

    In the first alternative (delete object), the value of the operand of delete may be a null pointer value, a pointer to a non-array object created by a previous new-expression, or a pointer to a subobject (1.8) representing a base class of such an object (Clause 10). [...] In the second alternative (delete array), the value of the operand of delete may be a null pointer value or a pointer value that resulted from a previous array new-expression.

    Translation:

    For the first optiondelete object), Operanda value delete may be the value of null-indicatoran indicator on an object which is not a mass established with the assistance of newor an indicator for an item (1.8), representing the base class of the object (see clause 10). [...] Second casedelete array), Operanda value may be the value of null-indicator or the value of the indicator obtained by means of new For masses.


    From https://isocpp.org/wiki/faq/freestore-mgmt#delete-handles-null :

    I need to check. null before delete p?

    No!

    Language C++ guarantees that delete p Nothing to do if p Yes. null


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2