Date: Thu, 5 May 2022 17:10:47 -0400
On Thu, May 5, 2022 at 5:00 PM Ville Voutilainen <
ville.voutilainen_at_[hidden]> wrote:
> 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.
>
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.
If you mean that today there's a way to end the lifetime of a
*non*-trivially-destructible
object without calling its destructor (and without just ending the
execution of the whole C++ program), then I didn't know about that. What is
that way?
–Arthur
ville.voutilainen_at_[hidden]> wrote:
> 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.
>
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.
If you mean that today there's a way to end the lifetime of a
*non*-trivially-destructible
object without calling its destructor (and without just ending the
execution of the whole C++ program), then I didn't know about that. What is
that way?
–Arthur
Received on 2022-05-05 21:10:59