Actual Size of undeclared object?

BlitzMax Forums/BlitzMax Beginners Area/Actual Size of undeclared object?

[edit] Title should read "undefined object", not undeclared.

Okay, I want to utilize an object of a given type more or less as a pointer to another object of that type.

Assume Type A is 50 bytes. I assumed that if you do Temp = New Type A, that Blitzmax allocates teh 50 bytes and stores a 'pointer' in Temp. Is this correct?

Also, I assumed that if you did something like
Temp2:Type A
Temp2 = Temp

that the compiler wouldn't allocate an additional 50 bytes for Temp2 since New() is never called on it. Instead, I'm assuming that it just copies over the 'pointer' from Temp. Is this correct?

Also, if I run this code
Type TBig
Field one,two,three
EndType

Type TBigger
Field four,five,six,seven,eight, nine, ten, eleven, twelve
EndType

Type TBiggest Extends TBigger

Field Big:TBig

EndType


Print SizeOf TBig
Print SizeOf TBigger
Print SizeOf TBiggest

Global Biggest:TBiggest
Print SizeOf Biggest.Big


I get some strange findings.

TBig = 12 bytes.
TBigger = 36 bytes
TBiggest = 40 bytes <---okay, so the TBig field is just a pointer.

This line, however

print sizeof( Biggest.Big )

returns 12. This is before I've even defined Biggest.Big. I'm assuming at this point it's returning the sizeof the type that Big is 'pointing to', and not the size allocated for Big itself.

I really hope that an undefined object doesn't require allocating the full sizeof the object. I plan on having a large array of these 'pointers'. The object itself might be a couple hundred bytes and I can't afford to have a 2000x2000 array of pointers that are each 200 bytes. :)