Hey folks. I am getting a size back from SizeOf() when using it with an empty array. For example, I have two types, used something like this:
This will print the size of the MySubType type, ie 12. Shouldn't it be printing 0? I haven't even allocated space for the `myarray` array yet. MyTypes[0].MyArray=Null. Why does SizeOf() give a size, 12, as if there is an instance of MySubType there, when there isn't? Surely it'd make more sense for it to say 0 since the array is empty?
Print String(SizeOf(MyTypes[0].MyArray)) will print 0 - ie the array is empty, but if I point SizeOf to an element in that array (e.g. [0]) shouldn't it also say 0?
Or is this how it's meant to work (why?)
Thanks for feedback.
Type MyMainType Field MyArray:MySubType[] 'empty array, zero size EndType Type MySubType Field MyInt:Int Field MyFloat:Float Field MyString:String End Type Local MyTypes:MyMainType[100] 'array of MyMainType instances MyTypes[0]=New MyMainType 'Create an instance at index 0 Print String(SizeOf(MyTypes[0].MyArray[0])) 'Print size of instance's array element
This will print the size of the MySubType type, ie 12. Shouldn't it be printing 0? I haven't even allocated space for the `myarray` array yet. MyTypes[0].MyArray=Null. Why does SizeOf() give a size, 12, as if there is an instance of MySubType there, when there isn't? Surely it'd make more sense for it to say 0 since the array is empty?
Print String(SizeOf(MyTypes[0].MyArray)) will print 0 - ie the array is empty, but if I point SizeOf to an element in that array (e.g. [0]) shouldn't it also say 0?
Or is this how it's meant to work (why?)
Thanks for feedback.