this() not executing code on structs

dsimcha dsimcha at yahoo.com
Wed Oct 21 11:52:24 PDT 2009


== Quote from zoli (galap at freemail.hu)'s article
> > > If the new "operator" for the class is redesigned to have multiply
allocation types
> > > (allocate on heap, allocate on stack, etc.?), there is no main drawback of using
> > classes instead of structs for small objects( like vec2, vec3) as well.
> >
> > Yes there is.  How about the cost of storing vtbl and monitor?  Actually, just
> I keep forgetting those (4-8) extra bytes per instance :)
> And what about the final classes (with no ancestors)?

Even final classes w/ no explicit ancestors are implicitly subclasses of Object,
which defines virtual functions.  Therefore, *all* class instances must have a
vtbl pointer.



More information about the Digitalmars-d mailing list