OffsetOf() to support array elements
Posted: Mon Oct 21, 2019 2:34 am
I have a particular structure where I want to know the offset of certain fields:
This works OK for OffsetOf() as it is. But these fields are similar enough to be in an array, which doesn't support OffsetOf():
It would be nice if we could do this:
Instead of card-coding this:
You might think that you could use SizeOf() on the field but this returns the size of the entire array.
Code: Select all
Structure SomeStruct
a1.l
a2.l
a3.l
b1.l
b2.l
b3.l
c1.l
c2.l
c3.l
EndStructure
Code: Select all
Structure SomeStruct
a.l[3]
b.l[3]
c.l[3]
EndStructure
Code: Select all
OffsetOf(SomeStruct\b[2])
Code: Select all
OffsetOf(SomeStruct\b)+SizeOf(Long)*2