digitalmars.D - .sizeof for classes
- Frank Benoit (16/16) Mar 27 2006 How to get the size of an object?
How to get the size of an object?
class Test
{
uint[10] a;
}
void main()
{
Test t = new Test;
assert( Test.sizeof == 4 );
assert( t.sizeof == 4 );
assert( Test.classinfo.init.length == 48 );
}
static assert( Test.classinfo.init.length == 48 ); // is not evaluatable
at compile time.
Isn't this syntax weird?
How can I get the size at compile time?
Mar 27 2006








Frank Benoit <frank nix.de>