4.28 Arrays/Records as Record Fields
Records may contain other records or arrays as fields. Consider the following definition:
type Pixel: record Pt: point; color: dword; endrecord;
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:
static 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:[ point:[ ...
Get The Art of Assembly Language, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.