SZerda,
The problem is that Structures are a static item, the same as constants.
Static items are resolved at compile time. The compiler uses the Structures to resolve all of the addresses, but then uses those addresses in the final executable. This means that the final executable has no knowledge of the structure.
For example, consider the following code:
Code: Select all
#S_Count = 10
Structure t
s.b[#S_Count]
t.b[4]
u.l
EndStructure
Debug SizeOf(t)
Debug OffsetOf(t\u)
The compiler knows at compile time that the offset of u will be 14 because it knows that s is an array of 10 bytes and t is an array of 4.
Variables, on the other hand, are dynamic. They can change value at run time. For this reason you cannot use them when defining a structure.