Date: Wed, 21 Dec 2022 08:52:00 -0300
On Tuesday, 20 December 2022 04:07:27 -03 Frederick Virchanza Gotham via Std-
Proposals wrote:
> 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.
That is not a correct assumption.
The problem is that if you're a reviewer and you're not familiar with the
expression, you may think it does the opposite and be a no-op + memory leak.
Anyway, you can do this better with a RAII type wrapper. There's no need for a
core language change here.
Proposals wrote:
> 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.
That is not a correct assumption.
The problem is that if you're a reviewer and you're not familiar with the
expression, you may think it does the opposite and be a no-op + memory leak.
Anyway, you can do this better with a RAII type wrapper. There's no need for a
core language change here.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering
Received on 2022-12-21 11:52:04