Yes, fully agree to Joergs interpretation.

Nikolai



Joerg Barfurth wrote:
I'd however like to establish a rule that classes/functions taking a
pointer to (possibly) not fully constructed classes have a comment that
explicitely allows that - assuming that everywhere else it is a bug.

Is a cast to the base class when passing "this" enough? Something like

A cast isn't really a comment. And Nikolai meant that the *recipient* of the argument must be commented,



Here I would see it from the other side: the ctor implementation of
"aControlElement" had a serious bug if it would call any virtual methods
on the "parent" pointer it gets passed in.


That is the case, if this restriction is part of the semantics of that constructor. I assume you mean that any VCL Window/Control class is required to offer this kind of semantics!? In that case there should be documentation somewhere (an appropriate common base class?) that states this, and Nikolai's suggestion is that the header for the class of aControllElement should reiterate that it implements that self-restriction.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to