News:

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

declaring nested structures with DUP

Started by Jeff, May 20, 2005, 11:31:41 PM

Previous topic - Next topic

Jeff

hello,
im having trouble declaring this array of structures.  the assembler keeps giving me the error: "error A2177: nested structure improperly initialized" for this portion of code:
POSITION STRUCT
    X WORD ?
    Y WORD ?
POSITION ENDS

MOVER STRUCT
    Keys POSITION 12 DUP(<>)
    NumKeys WORD ?
MOVER ENDS

.DATA?
pole POSITION 20 DUP(<>)
car MOVER 10 DUP(<>)                ;A2177


i cant figure out how to get it done since MSDN's reference isnt very helpful.  could you guys help me out?

MazeGen

Hello,
try DUP (?) instead of DUP(<>).

Jeff

unfortunately, it isnt that simple.  i want the variable "car" to reference an array of "MOVER" structures (multiple cars) which each also contains an array of "POSITION" structures.

i cant use DUP (?) since im trying to declare structures.  of course i could manually initialize each individual structure but i just cant see why i cant use DUP.


car MOVER <>,<>,<>,<>,<>,<>,<>,<>,<>,<>     ;works
car MOVER 10 DUP(<>)                        ;A2177

MichaelW

Hi Jeff,

Using individual initializers was the only thing I could find that would work. The MASM Programmer's Guide does not seem to cover nested structure arrays:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_05.htm

eschew obfuscation

Jeff

yeah, thanks guys.  ive been reading through the reference and programmers guide for anything on declaring nested structures/unions and arrays of structures/unions but it never went over structures/unions with an array of structures.  its just very inconvenient to not be able to have a true array of these.

and, if anyone's interested, http://www.visualassembler.com/ has both guides as pdfs available for download.  (both containing all graphics in the manual and not grayed out)  scroll to the bottom.