News:

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

Newbie question here

Started by sayain_code, October 21, 2009, 07:56:14 AM

Previous topic - Next topic

sayain_code

Got a question about this line of code
hitpoint POINT <>

It relates to
-ASM Book - Iczelion Tutorial 7 (en) "Mouse Input"

1. What does the <> mean array?
2. Why does it have to Have POINT after hitpoint?
3. What does POINT even mean?

BlackVortex

"POINT" has to be defined somewhere in the includes (or earlier in the asm file itself)

So, the name goes first, then the type of the structure, which is declared elsewhere.

Neil

As BlackVortex says, POINT is defined elsewhere & in this case it is in the .data? section. This structure contains the x & y coordinates. If you look after the line saying .ELSEIF uMsg==WM_LBUTTONDOWN, you will see how this structure gets filled.

raymond

And the <> means that the structure is not initialized to anything specific. When you declare a structure in the .data or .data? sections, you can expect each member of the structure to be "initialized" with 0.

However, if you want to initialize a structure in the .data section with something other than 0's, you would declare it as follows for example:
hitpoint POINT <120,150>

Only two values are inserted above because that POINT structure contains only two members. If a structure contains N members, you would then have to include N values in the <>.

Most structures used with Windows functions are defined in the windows.inc file in the INCLUDE folder of the MASM32 package. However, you can create any structure you wish but you have to define it before you use it, normally ahead of your .data sections.
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com