size of a class instance

Lionello Lunesu lio at lunesu.remove.com
Mon Nov 13 23:53:55 PST 2006


Sean Kelly wrote:
> Bill Baxter wrote:
>> Is this really the best way to get the size of a class instance given 
>> the type?
>>
>>   MyClass.classinfo.init.length;
> 
> Yes.  And this only works at run time.  I proposed a new .isizeof 
> property to simplify things, but it didn't seem terribly popular.  See:
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=88
> 
> 
> Sean

I suppose sizeof(MyClass) could simply return the right value. I don't 
see how the size of a class' handle can be useful.

L.



More information about the Digitalmars-d-learn mailing list