Hi Sean,
> Problem being that, according to the standard, 'this' isn't required to
be
> a valid pointer until the body of the constructor has been entered. A
fix
> would likely require adding a new protected method to the parent class to
> pass the pointer.
Can you provide a reference to the part of the standard that supports your
statement? I believe the 'this' pointer can be used in the
mem-initializer, as per 12.6.7 and 12.6.8 (which seem to contradict your
statement).
However, I do think passing the 'this' pointer to another object before the
constructor has completed is potentially dangerous, because the callee must
be aware the object is not yet fully constructed.
Thanks!
Dave
Sean Kelly
<[EMAIL PROTECTED]> To: [EMAIL PROTECTED]
Sent by: Sean cc: (bcc: David N
Bertoni/Cambridge/IBM)
Kelly Subject: 'this' used in base member
initializer list
<[EMAIL PROTECTED]>
09/29/2003 04:23
PM
Please respond
to xerces-c-dev
Just got the latest copy of the source and noticed this hasn't been
cleared up. The offending files are:
DocumentImpl.cpp
DOMParentNode.cpp
DOMDocumentImpl.cpp
The code that's breaking is similar to this:
DocumentImpl::DocumentImpl(MemoryManager* const manager)
: ParentNode(this)
Problem being that, according to the standard, 'this' isn't required to be
a valid pointer until the body of the constructor has been entered. A fix
would likely require adding a new protected method to the parent class to
pass the pointer.
I apologize if this has been discussed before... didn't see it in the
recent threads. And it looks like DocumentImpl is on its way to being
deprecated, is this true?
Sean
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]