C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 5 May 2022 23:59:57 +0300
On Thu, 5 May 2022 at 23:48, Arthur O'Dwyer via Std-Proposals
<std-proposals_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.

Received on 2022-05-05 21:00:10