C++ Logo

std-proposals

Advanced search

Re: [std-proposals] delete p = nullptr;

From: Peter Olsson <dataapa_at_[hidden]>
Date: Tue, 20 Dec 2022 11:02:51 +0100
> The following two lines of code make no sense:
>
> p = nullptr;
> delete p;
>
> Therefore when you see "delete p = nullptr;", irrespective of
> whether you're familiar with operator precedence, you know
> that it must be setting the pointer to null after delete'ing
> it, because nothing else makes sense.

Only if you assume that the code you're reading is correct.

Received on 2022-12-20 10:03:04