C++ Logo


Advanced search

Re: [std-proposals] Relax the restriction on the operand of a single-object delete-expression

From: blacktea hamburger <greenteahamburger_at_[hidden]>
Date: Sat, 1 Oct 2022 21:40:59 +0800
On Sun, Sep 4, 2022 at 8:58 PM Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Sunday, 4 September 2022 03:45:51 CDT blacktea hamburger via
> Std-Proposals
> wrote:
> > Well, it doesn't quite make sense, but it's possible. I think the
> standard
> > should allow all possible and logically plausible codes.
> No, it shouldn't and doesn't. There are very good reasons to disallow
> certain
> code that some people may reasonably find logical (such as signed integer
> overload). So your argument is not going to hold water.
> If you want the standard to change, then provide a good and different
> argument.

It can help with optimization, see https://www.airs.com/blog/archives/120.

> The wording of [expr.delete]/2 seems to only take into account that
> objects
> > can only be created by new expressions (since IOC was added very late),
> and
> > that's the issue.
> I don't see the issue. Why can;'t you new this object using the placement
> new?


The above snippets have a common theme: they attempt to use objects that
they never created. Indeed, there is a family of types for which
programmers assume they do not need to explicitly create objects. We
propose to identify these types, and carefully carve out rules that remove
the need to explicitly create such objects, by instead creating them

Received on 2022-10-01 13:41:27