Go to the first, previous, next, last section, table of contents.
-
An indexed_component denotes either a component of an array or an entry
in a family of entries.
Syntax
-
indexed_component ::= prefix(expression {, expression})
Name Resolution Rules
-
The prefix of an indexed_component with a given number of expressions
shall resolve to denote an array (after any implicit dereference) with
the corresponding number of index positions, or shall resolve to denote
an entry family of a task or protected object (in which case there shall
be only one expression).
-
The expected type for each expression is the corresponding index type.
Static Semantics
-
When the prefix denotes an array, the indexed_component denotes the
component of the array with the specified index value(s). The nominal
subtype of the indexed_component is the component subtype of the array
type.
-
When the prefix denotes an entry family, the indexed_component denotes
the individual entry of the entry family with the specified index value.
Dynamic Semantics
-
For the evaluation of an indexed_component, the prefix and the
expressions are evaluated in an arbitrary order. The value of each
expression is converted to the corresponding index type. A check is made
that each index value belongs to the corresponding index range of the
array or entry family denoted by the prefix. Constraint_Error is raised
if this check fails.
Examples
-
Examples of indexed components:
-
My_Schedule(Sat)
-- a component of a one-dimensional array See section 3.6.1 Index Constraints and Discrete Ranges
Page(10)
-- a component of a one-dimensional array See section 3.6 Array Types
Board(M, J + 1)
-- a component of a two-dimensional array See section 3.6.1 Index Constraints and Discrete Ranges
Page(10)(20)
-- a component of a component See section 3.6 Array Types
Request(Medium)
-- an entry in a family of entries See section 9.1 Task Units and Task Objects
Next_Frame(L)(M, N)
-- a component of a function call See section 6.1 Subprogram Declarations
NOTES
-
(1) Notes on the examples: Distinct notations are used for components of
multidimensional arrays (such as Board) and arrays of arrays (such as
Page). The components of an array of arrays are arrays and can therefore
be indexed. Thus Page(10)(20) denotes the 20th component of Page(10). In
the last example Next_Frame(L) is a function call returning an access
value that designates a two-dimensional array.
Go to the first, previous, next, last section, table of contents.