Hi Ben,

On Mon, Aug 22, 2011 at 3:40 PM, Ben Stott <[email protected]> wrote:
>
> > > You also don't have your deallocation ordering strictly correct. The
> stack
> > > unwind will always be the last-constructed order - so if you declare a
> > > Fl_Group above a Fl_Widget, the Fl_Widget will be destructed *before*
> the
> > > Fl_Group.
> >
> > Ya, I know - I call it DMB (DUMB) destruction - (D)erived classes,
> (M)embers
> > and (B)ase. I probably mis-typed something in a hurry.
>
> Even still, not quite. Per-object this is right, but all derived classes
> aren't destroyed together, and then all members, etc. Though I assume you
> know this already.
>

Yes, hierarchy is always maintained - recursively in case of each object.


> > That's exactly what I wanted to know. But the question remans: when
> should I
> > create member widgets as pointers and when should I create them as direct
> > object members (non pointers, that is)?
>
> Well, this is an entirely different question; when to use a pointer vs when
> to use an object. This depends on a heap of things; cache locality being one
> (if you're not updating objects constantly, you'll get more benefit from the
> cpu cache in using objects). Pointers can also use magic to be casted up and
> down the derived tree; objects can't.
>

I guess I am safer with pointers.


> Ben
>

Best, Asif
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to