Next: , Up: Mapping Arrays   [Contents][Index]


14.14.5.1 Array maps bounded by number of elements

When an array type bounded by number of elements is used in a mapping operation, the resulting mapped array is also bounded by number of elements.

For example, this is how we would map an array of four 32-bit signed integers in the current IO space:

(poke) int[4] @ 0#B
[10,20,30,40]

Since you can also provide a dynamic array type to the map operator, the number of elements doesn’t need to be constant. For example, given the variable nelems has a value of 2:

(poke) var nelems = 2
(poke) int[nelems + 1] @ 0#B
[100,222,333]

If an end-of-file condition happens while mapping the array, because the number of elements specified in the array type, at the given offset, exceeds the capacity of the underlying IO device, an exception is raised and the mapping is not completed:

(poke) int[99999999999] @ 0#B
unhandled EOF exception

Likewise, if a constraint fails while performing the mapping (while mapping an array of structs, for example) an exception is raised and the map is aborted.