DMD 0.161 release

BCS BCS at pathlink.com
Thu Jun 22 10:31:37 PDT 2006


xs0 wrote:
> Ben Hinkle wrote:
> 
>> ok, I see what you mean. thanks for explaining. Pretty cool! Since the 
>> vtable lookup is linear in the total number of interfaces the class 
>> implements (including the interfaces of super-interfaces) it could be 
>> more noticeable in larger examples.
> 
> 
> Well, the lookup need not be linear. Since the interfaces are known in 
> advance for each class, it should be possible to achieve a fast O(1) 
> lookup with something like a [minimal] perfect hash function, all you'd 
> probably need is some sort of numeric identifier for each interface 
> (could simply be a MD5 of its full name or something).
>


I would expect that the pointer-to-vtbl for the interface would be 
placed in the classes vtbl. class to interface cast would consist of (in 
sudo code)


/** i = c;  **/

interface_Ijk_Struct i;
with (i)
{
	contextPtr = c;
	vtbl = c.vtbl[Ijk_Vtbl];
}

////// What am I missing?
	



More information about the Digitalmars-d-announce mailing list