Reddit: why aren't people using D?

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Jul 23 12:24:01 PDT 2009


On Thu, Jul 23, 2009 at 3:13 PM, Steven
Schveighoffer<schveiguy at yahoo.com> wrote:
>
> Can you do that with classes, I don't know.  I thought it was impossible to
> allocate several classes in one block.  It was pretty easy to do the custom
> allocator with structs...

Ah, that's a good point.  It is in fact possible; you can use
typeid(Class).classinfo.init.length to get the size of an instance at
runtime, or with D2, __traits(classInstanceSize, Class) will get you
the same thing, at compile time.  Though your other reasons are
certainly more than enough justification to move to structs (which,
like you said, they probably should have been in the first place) :)



More information about the Digitalmars-d mailing list