What would be the consequence of implementing interfaces as fat pointers ?
Walter Bright
newshound2 at digitalmars.com
Sat Mar 29 18:42:36 PDT 2014
On 3/29/2014 6:11 PM, deadalnix wrote:
> I'm talking about interface here. The way they are implemented in most new
> language is via a struct that contains:
> - pointer to the object
> - pointer to vtable
>
> That way to don't make object bigger when they implement an interface,
True, but why is this a problem?
> and you don't need cascaded load to call methods.
True, but on the other hand, it takes up 2 registers rather than one, costing
twice as much to copy around, store, pass/return to functions, etc.
More information about the Digitalmars-d
mailing list