All right, newbie question here ;)

I've consulted the MASM documentation and a bunch of other tutorials, etc. but I can't seem to find an answer to exactly what the <> operator means when used in a data declaration.

As I understand it, if you do something like:
.const

MAXBYTE equ <FFh>


And then later on you have:
.code

mov al, MAXBYTE


Then the assembler will automatically replace MAXBYTE with the literal text value between <> to make
.code

mov al, FFh


So it's basically just a macro of sourts in that context.

But what does a declaration like this mean?
.data

complex COMPLEXSTRUCT <>

It seems like I only see this used with structs/objects. What exactly does the data get initiailzed to?
Posted on 2004-08-13 14:59:01 by point
They are used to indicate that the set of values contained are to initialize the structure. <> with nothing in between will initialize it to 0 or the values in the structure definition. Structures work about the same in MASM as in GoAsm, here is the GoAsm explanation :

http://www.jorgon.freeserve.co.uk/GoasmHelp/GoAsm.htm#struc
Posted on 2004-08-13 15:07:49 by donkey
Ah. Thank you. I knew there was some obvious answer to this. The trouble is, it's hard to do a search on something like < or > because they're special characters that are often ignored or used in the search engine's syntax itself.

So functionally speaking, if I have this structure:
RECT STRUCT

left db 0
right db 0
top db 10
bottom db 10
ENDS

then wouldn't
rectangle RECT

do the same thing as
rectangle RECT <>


Legibility-wise, I'd prefer to use the <> anyway, but I just want to make sure there's not some subtle difference I'm missing.

I think I understand why I never see anyone actually provide a list of values, now. Most win32 structures tend to have a lot of members, including nested structures. Those sound like they'd be confusing to declare using that syntax. It sounds like it's probably best to not do that except with very simple structures (again, from the standpoint of code clarity). Plus they tend to rely on run-time values for most of their members anyway, so it would be pretty pointless.
Posted on 2004-08-13 15:41:50 by point
I think in MASM you have to have the <> though it accepts alot of ways...

rect RECT <1,2,3,4> ; rect.left=1,rect.right=2 etc...

rect RECT <1,2,3,4>,<5,6,7,8>,<9,0Ah,0Bh,0Ch> ; three initialized rects

rect RECT <?> ; store as uninitialized

rect RECT <0> ; store initiliaized to 0

rect RECT 16 DUP (<>) ; 16 structures
Posted on 2004-08-13 15:46:24 by donkey