|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2003-10-09 23:57:37
On Friday 10 October 2003 12:02 am, E. Gladyshev wrote:
> char *p = new( (void*)&m.x );
>
> I am using the part of already constructed object 'm' to construct
> another object so is 'm' lifetime is over?
Apparently you did not read the clause David A. cited. Part of it says:
12.6.2 describes the lifetime of base and member subobjects
Did you read 12.6.2?
> [...]
>
> > It's hard to stay this without being incendiary, but just because you
> > were not able to deduce the concept of "reusing storage" from the
> > standard text does not mean that it is undefined.
>
> Can anybody deduce it for me please and show the deduction?
Did you read the relevant parts of the standard that I mentioned? Probably not
in the 17 minutes from when I hit the "send' key until the time I received a
response.
> > as has been pointed out several times.
>
> Don't point out, please prove it.
I have: http://lists.boost.org/MailArchives/boost/msg53635.php
Summary: you ended the lifetime of an object, then tried to resurrect it by
copying the bits back. It doesn't even take *any* deduction to see that the
code invokes undefined behavior, because the standard explicitly states what
happens, and we've quoted the relevant clause. You don't need a grand concept
of storage reuse to show that the code is wrong; you need one clause and a
little pattern matching.
> > If you would like to try another
> > approach, please feel free to. However, do not expect us to hold you hand
> > to lead you to the conclusion we have already reached long ago
>
> You have reached a wrong conclusion!
Our proof is in the open. Show us where it is wrong.
> The right conclusion would be to streamline
> the standard reagarding storage concept and
> then go back to the discussion of the object
> lifetime concept.
Wait, so we're supposed to rewrite an international standard first, and then
come back to this discussion? Even if this were even remotely feasible (it
isn't), this is the wrong forum for such things. We develop C++ libraries; we
do not write standards.
At Boost we try to keep an open mind, we hope to learn from each other, and we
don't mind teaching from time to time. We do enjoy a fresh perspective on an
old problem, and some problems that were considered unworkable have indeed
been solved. But they have not been solved by ignoring the old arguments, the
ones that prove ways in which the problem can't be solved. You have
categorically refused to do your share to understand the old arguments, and
in doing so have closed our minds.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk