Size of a class instance at compile time

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Jan 14 11:19:43 PST 2007


Frits van Bommel wrote:
> Ah, that's a good solution to that problem I guess.
> Unless there's ever any weird need to put overhead bytes at the end that 
> should work.
> (Where are interface vtable pointers put? [tests] Damn, looks like 
> they're at the end :( )

So I was wondering, could is(T supertuple == super) be of help here?
Specifically, how many interface vptrs are there in an object? One per 
interface? Or are inherited interfaces folded like classes, one vptr per 
most-derived interface?
I think this could be made to work if we figure out the details.
It looks to a bit complicated though, since I'm guessing interfaces of 
base classes come before members of derived classes. That plus 
double.alignof > (void*).alignof on x86 means that to determine 
alignment gaps correctly we'd probably need to work from Object up...
I don't feel like coding that right now :(.


More information about the Digitalmars-d-learn mailing list