size of a class instance

Craig Black cblack at ara.com
Mon Nov 13 08:50:48 PST 2006


I like isizeof better than classinfo.init.length.  Not only for brevity, but 
a compile time value could be useful.

"Sean Kelly" <sean at f4.ca> wrote in message 
news:ej9u8k$2ek2$1 at digitaldaemon.com...
> 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 





More information about the Digitalmars-d-learn mailing list