SizeOf() shows size for non-existant instance?

BlitzMax Forums/BlitzMax Programming/SizeOf() shows size for non-existant instance?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

My guess would be that
Print String(SizeOf(MyTypes[0].MyArray))

Print the size of the array, which currently has no pointers inside it, that's why it will print 0.

When you use
Print String(SizeOf(MyTypes[0].MyArray[0]))

BMax knows that the array's indexes will point to instances of the type-declaration "MySubType" and therefore it will print the size of the type-declaration, even when no instance has been created yet.

The type declaration MysubType would use 12 bytes, because an int uses 4 bytes, a float uses 4 bytes and the string also uses 4 bytes, because the MyString field is actually a pointer to a string-object, where a pointer is also an int.