Date: Sat, 18 Apr 2020 16:19:20 -0400
> If my approach is taken, I think everything already falls in place
properly and a DR is not needed.
I'm not sure if I understand what you've said. I think you've concluded
that paragraph 6 applies to pb and paragraph 7 applies to *pb despite the
fact that the storage has been reused. Is that because the phrase "such a
pointer" refers to the noun phrase "any pointer that represents the address
of the storage location where the object will be or was located", but
without the preceding qualifications of "Before ... or, after ...
released"? I think that would be a strange reading, for a few reasons. Or
is it something else?
On Sat, Apr 18, 2020 at 2:39 PM Tadeus Prastowo <tadeus.prastowo_at_[hidden]>
wrote:
> On Sat, Apr 18, 2020 at 3:53 PM Andrew Schepler <aschepler_at_[hidden]>
> wrote:
> >
> > On Fri, Apr 17, 2020 at 9:03 PM Tadeus Prastowo <
> tadeus.prastowo_at_[hidden]> wrote:
> >>
> >> On Sat, Apr 18, 2020 at 12:02 AM Andrew Schepler <aschepler_at_[hidden]>
> wrote:
> >> >
> >> > That seems mostly right, but a few things still sounded off to me. So
> I'm not sure if I'm agreeing or disagreeing, reading something a way it
> wasn't met, etc., but:
> >> >
> >> > Recapping the labels from previous messages:
> >> >
> >> > (Sentence-X):
> >> > "Before the lifetime of an object has started but after the storage
> which the object will occupy has been allocated or, after the lifetime of
> an object has ended and before the storage which the object occupied is
> reused or released, any pointer"
> >> > (Condition-1):
> >> > "that represents the address of the storage location where the
> object will be or was located"
> >> > "may be used but only in limited ways."
> >>
> >> This approach will work on the condition that "before the storage
> >> which the object occupied is reused" is interpreted as reused _only_
> >> through the original pointer, which in the example in question is the
> >> pointer `pb'. If "before the storage which the object occupied is
> >> reused" is not interpreted as such, the approach will fail for the
> >> example in question because for the particular point being discussed,
> >> which is the expression `*pb' being OK, the condition "before the
> >> storage which the object occupied is reused" does not hold owing to
> >> the allocated storage being reused through the pointer `this' within
> >> the member function `mutate'.
> >
> >
> > Oh, I hadn't noticed that. I don't like that interpretation: "the
> storage which the object occupied" is a property of the memory model and
> the object, not any particular syntax.
>
> I second that.
>
> > Nothing else I know of really supports "storage reused through a
> pointer" having particular meaning. Now I think the example just doesn't
> match the normative text, and a Defect Report would be appropriate.
>
> If my approach is taken, I think everything already falls in place
> properly and a DR is not needed.
>
> > One example that does match the text would be use of a pointer to union
> member during the union's lifetime, before the member is manually created
> with a placement new-expression and/or after the member is manually
> destroyed with a destructor call.
> >
> > Or, it seems likely the intent was for the wording to apply to cases
> like the example, so including pointers which pointed to objects whose
> lifetime ended because the unreleased storage was reused,
>
> That I think is indeed the case.
>
> > but excluding pointers which point at the new object per paragraph 8.
>
> The pointers are not excluded if my approach is taken.
>
> > It's also confusing that paragraph 8 says "If, ... before the storage
> which the object occupied is reused or released, a new object is created at
> the storage location which the original object occupied".
>
> It is not confusing if my approach is taken.
>
> > Isn't creating that object the exact meaning of "storage is reused"?
>
> If what you mean by "that object" is the conceptual object referred in
> the standard by "a new object is created at the storage location which
> ...", then yes, the storage referred by "... at the storage location
> which ..." is reused.
>
> > Maybe it means the storage was not previously reused?
>
> I don't understand your question.
>
> > Or maybe in all of paragraphs 6, 7, and 8, changing "is reused or
> released" to just "is released", and clarifying that paragraph 8 has
> precedence over 6 and 7, would better match the intent? (The Note and
> Example in [intro.object]/3 do seem to confirm creating an object via
> placement new can be one case of "reused storage".)
>
> No, I don't think so.
>
> --
> Best regards,
> Tadeus
>
properly and a DR is not needed.
I'm not sure if I understand what you've said. I think you've concluded
that paragraph 6 applies to pb and paragraph 7 applies to *pb despite the
fact that the storage has been reused. Is that because the phrase "such a
pointer" refers to the noun phrase "any pointer that represents the address
of the storage location where the object will be or was located", but
without the preceding qualifications of "Before ... or, after ...
released"? I think that would be a strange reading, for a few reasons. Or
is it something else?
On Sat, Apr 18, 2020 at 2:39 PM Tadeus Prastowo <tadeus.prastowo_at_[hidden]>
wrote:
> On Sat, Apr 18, 2020 at 3:53 PM Andrew Schepler <aschepler_at_[hidden]>
> wrote:
> >
> > On Fri, Apr 17, 2020 at 9:03 PM Tadeus Prastowo <
> tadeus.prastowo_at_[hidden]> wrote:
> >>
> >> On Sat, Apr 18, 2020 at 12:02 AM Andrew Schepler <aschepler_at_[hidden]>
> wrote:
> >> >
> >> > That seems mostly right, but a few things still sounded off to me. So
> I'm not sure if I'm agreeing or disagreeing, reading something a way it
> wasn't met, etc., but:
> >> >
> >> > Recapping the labels from previous messages:
> >> >
> >> > (Sentence-X):
> >> > "Before the lifetime of an object has started but after the storage
> which the object will occupy has been allocated or, after the lifetime of
> an object has ended and before the storage which the object occupied is
> reused or released, any pointer"
> >> > (Condition-1):
> >> > "that represents the address of the storage location where the
> object will be or was located"
> >> > "may be used but only in limited ways."
> >>
> >> This approach will work on the condition that "before the storage
> >> which the object occupied is reused" is interpreted as reused _only_
> >> through the original pointer, which in the example in question is the
> >> pointer `pb'. If "before the storage which the object occupied is
> >> reused" is not interpreted as such, the approach will fail for the
> >> example in question because for the particular point being discussed,
> >> which is the expression `*pb' being OK, the condition "before the
> >> storage which the object occupied is reused" does not hold owing to
> >> the allocated storage being reused through the pointer `this' within
> >> the member function `mutate'.
> >
> >
> > Oh, I hadn't noticed that. I don't like that interpretation: "the
> storage which the object occupied" is a property of the memory model and
> the object, not any particular syntax.
>
> I second that.
>
> > Nothing else I know of really supports "storage reused through a
> pointer" having particular meaning. Now I think the example just doesn't
> match the normative text, and a Defect Report would be appropriate.
>
> If my approach is taken, I think everything already falls in place
> properly and a DR is not needed.
>
> > One example that does match the text would be use of a pointer to union
> member during the union's lifetime, before the member is manually created
> with a placement new-expression and/or after the member is manually
> destroyed with a destructor call.
> >
> > Or, it seems likely the intent was for the wording to apply to cases
> like the example, so including pointers which pointed to objects whose
> lifetime ended because the unreleased storage was reused,
>
> That I think is indeed the case.
>
> > but excluding pointers which point at the new object per paragraph 8.
>
> The pointers are not excluded if my approach is taken.
>
> > It's also confusing that paragraph 8 says "If, ... before the storage
> which the object occupied is reused or released, a new object is created at
> the storage location which the original object occupied".
>
> It is not confusing if my approach is taken.
>
> > Isn't creating that object the exact meaning of "storage is reused"?
>
> If what you mean by "that object" is the conceptual object referred in
> the standard by "a new object is created at the storage location which
> ...", then yes, the storage referred by "... at the storage location
> which ..." is reused.
>
> > Maybe it means the storage was not previously reused?
>
> I don't understand your question.
>
> > Or maybe in all of paragraphs 6, 7, and 8, changing "is reused or
> released" to just "is released", and clarifying that paragraph 8 has
> precedence over 6 and 7, would better match the intent? (The Note and
> Example in [intro.object]/3 do seem to confirm creating an object via
> placement new can be one case of "reused storage".)
>
> No, I don't think so.
>
> --
> Best regards,
> Tadeus
>
Received on 2020-04-18 15:22:30