digitalmars.D - class .sizeof
- dsimcha (3/3) Oct 28 2009 For making the GC precise, I need to be able to get at the size of a cla...
- Lars T. Kyllingstad (4/7) Oct 28 2009 Not sure if it's what you're after, but there is something called
- dsimcha (2/9) Oct 28 2009 Yep, that's it. For some reason I didn't think to look there.
For making the GC precise, I need to be able to get at the size of a class instance at compile time. The .sizeof property returns the size of a reference, i.e. (void*).sizeof. I need the amount of bytes an instance uses.
Oct 28 2009
dsimcha wrote:For making the GC precise, I need to be able to get at the size of a class instance at compile time. The .sizeof property returns the size of a reference, i.e. (void*).sizeof. I need the amount of bytes an instance uses.Not sure if it's what you're after, but there is something called __traits(classInstanceSize,T). -Lars
Oct 28 2009
== Quote from Lars T. Kyllingstad (public kyllingen.NOSPAMnet)'s articledsimcha wrote:Yep, that's it. For some reason I didn't think to look there.For making the GC precise, I need to be able to get at the size of a class instance at compile time. The .sizeof property returns the size of a reference, i.e. (void*).sizeof. I need the amount of bytes an instance uses.Not sure if it's what you're after, but there is something called __traits(classInstanceSize,T). -Lars
Oct 28 2009