C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Relocation in C++

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 02 May 2022 12:29:42 -0700
On Monday, 2 May 2022 12:15:00 PDT Lénárd Szolnoki via Std-Proposals wrote:
> I'm pretty sure in MSVC parameters are destroyed by the callee. I don't
> think that this is non-conforming.
>
> https://godbolt.org/z/9soos71ae

I stand corrected.

You're right, from the language's point of view it makes no difference whether
the destruction happens before the RET instruction or after (that's not
observable in the abstract machine), so long as the ordering of destruction
remains consistent. That is, if the two objects x and y in

  foo(x, y);

are destroyed in the right order, regardless of who does it.

I was thinking that there could be some side-effects that only the caller
would know about and that it would require that the caller destroy it, but on
second thought I can't think of any.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2022-05-02 19:29:43