What C++17 standard say about calling delete on nullptr?

前端 未结 2 590
礼貌的吻别
礼貌的吻别 2021-01-21 14:36

C++03 Standard say\'s:

5.3.5 Delete

[...] In either alternative, if the value of the operand of delete is the null pointer the operat

2条回答
  •  情话喂你
    2021-01-21 15:38

    Yes it is valid, and it results in a noop. reference

    If expression evaluates to a null pointer value, no destructors are called, and the deallocation function is not called.

提交回复
热议问题