News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Array of Structs

Started by RedXVII, April 02, 2007, 07:32:59 PM

Previous topic - Next topic

RedXVII

Arrays of structs kindof work provided you use the SIZE macro in the square brackets. But my question is, has anyone figured out a way of polymorphing or macroing the []'s to do this automatically?


LOCAL x[2]:RECT

mov eax, x[1]               ;This wont work, but its the desired way of doing it :(
mov eax, x[ 1*SIZE x ]   ;This works lovely :)

Ratch

RedXVII ,
QuoteBut my question is, has anyone figured out a way of polymorphing or macroing the []'s to do this automatically?

     I believe index brackets in a STRUCT are hardwired to interpret their value in bytes only.  If you know the size of the indexed elements of the array, you could do something like MOV EAX,[1*DWORD] , MOV EAX,[2*WORD], etc.  Ratch