4.32. 4.32 Arrays/Records as Record Fields

Records may contain other records or arrays as fields. Consider the following definition:

               Pt:        point;
               color:     dword;

The definition above defines a single point with a 32-bit color component. When initializing an object of type Pixel, the first initializer corresponds to the Pt field, not the x-coordinate field. The following definition is incorrect:

     ThisPt: Pixel := Pixel:[ 5, 10 ];   // Syntactically incorrect!

The value of the first field ("5") is not an object of type point. Therefore, the assembler generates an error when encountering this statement. HLA will allow you to initialize the fields of Pixel using declarations like the following:

static ThisPt: Pixel := Pixel:[ ...

Get Art of Assembly Language, 1st Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.