C++ Logo

std-discussion

Advanced search

Re: Wording Includes Normal Use Case

From: Brian Bi <bbi5291_at_[hidden]>
Date: Thu, 23 Nov 2023 15:50:54 -0500
On Thu, Nov 23, 2023 at 2:43 PM Jens Maurer via Std-Discussion <
std-discussion_at_[hidden]> wrote:

>
> On 23/11/2023 19.42, Daniel Markus via Std-Discussion wrote:
> > Maybe I'm picky and probably everyone understands what is meant, but
> > what's said right now is that the (an) other object occupies its own
> > storage location, which is the normal use case.
>
> There is half a sentence in front that talks about ending the lifetime
> prior to the implicit destructor call, and there is an example that
> follows.
>
> What exactly is unclear here?
>

I think the issue is that the normative wording is not clear about the
temporal relationship, i.e., that the UB only occurs if the ending of the
lifetime (without subsequent recreation of an object of the same time)
happens *before* the implicit destructor call---as opposed to when you do
nothing and just let the implicit destructor call take place (in which case
the ending of the lifetime occurs at the same time as the implicit
destructor call, because the start of the implicit destructor call ends the
lifetime).


>
> Jens
>
>
> > Br,
> > Daniel
> >
> >
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > *From:* Std-Discussion <std-discussion-bounces_at_[hidden]> on
> behalf of Lénárd Szolnoki via Std-Discussion <
> std-discussion_at_[hidden]>
> > *Sent:* Thursday, November 23, 2023 19:25
> > *To:* std-discussion_at_[hidden] <std-discussion_at_[hidden]>
> > *Cc:* Lénárd Szolnoki <cpp_at_[hidden]>
> > *Subject:* Re: [std-discussion] Wording Includes Normal Use Case
> >
> > Or just replace "another" with "an"? "... an object of the original
> type does not occupy that same storage location ..."
> >
> >
> >
> > On 23 November 2023 18:05:56 GMT, Daniel Markus via Std-Discussion <
> std-discussion_at_[hidden]> wrote:
> >
> > Hi!
> >
> > I'm trying to learn about object lifetime and am reading the
> specification. When I was
> > reading §6.7.3/9 I realized that "another object of the original
> type does not occupy
> > that same storage location" is applicable also for the normal use
> case. I.e. a normal
> > destruction would also be undefined.
> >
> > Would the following wording amend it?
> > "another object not of the original type does occupy..."
> >
> > Here's the commit.
> >
> https://github.com/cplusplus/draft/commit/84087b3d3f0f60a2878a89810a1c4d0e354722d9
> <
> https://github.com/cplusplus/draft/commit/84087b3d3f0f60a2878a89810a1c4d0e354722d9
> >
> >
> > Best regards,
> > Daniel Markus
> >
> >
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
*Brian Bi*

Received on 2023-11-23 20:51:11