C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 6 May 2022 00:19:20 +0300
On Fri, 6 May 2022 at 00:10, Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]> wrote:
>> > Right, I think there's a mismatch between the way Avi was using/understanding the terminology and the way you (and I) use it.
>> > - Immediately after a call to std::relocate_at (or the core-language `operator reloc` or whatever), the source object has become destroyed and its lifetime is over.
>> > - But the destructor is not called.
>> > This terminology is confusing in the context of today's C++, because today's C++ does not (admit|permit) any difference between the ideas of "the object's lifetime ends" and "the object's destructor is called." We are able to use the same English phrase — "the object is destroyed" — to mean both notions, interchangeably, without any ambiguity, because they are literally synonymous in C++ today.
>> > In C++-with-relocation (whether P1144 or otherwise), it is possible for an object's lifetime to end in either of two different ways: either its destructor is called, or it is relocated-from. In the former case, its destructor is called; in the latter case, its destructor is never called. The phrase "the object is destroyed" should now be avoided, because it is ambiguous: it could be taken to mean either "the object's destructor is called," or "the object's lifetime ends," and these notions are now no longer synonymous.
>>
>> I don't quite follow. The notions aren't synonymous in today's C++, as
>> you can end the lifetime of an object without invoking a destructor,
>> and C++ permits such a difference just fine.
>
>
> You mean if it's trivially destructible, right? (I notice you said "a" destructor rather than "its" destructor, which makes me think you're thinking of types that don't have destructors at all, like `int`.) If so, I wasn't worrying about that quibble.

We seem to disagree on what the word "quibble" means, and what its
appropriate uses are. The point is that introducing a new notion
where an object's lifetime ends without invoking the object's
destructor is not novel, and shouldn't be confusing. The lofty claim
that
"end lifetime" and "invoke the destructor" are synonymous is not
correct, so suggesting that as a basis for this hypothetical confusion
is ill-formed, if you ask me.

Received on 2022-05-05 21:19:33