Ada Conformity Assessment Authority |
Home |
Conformity Assessment | Test Suite |
ARG | Ada Standard |

The argument N used in the attribute_designators
for the N-th dimension of an array shall be a static expression
of some integer type. The value of N shall be positive (nonzero) and
no greater than the dimensionality of the array.

The following attributes are defined for a prefix
A that is of an array type (after any implicit dereference), or denotes
a constrained array subtype:

A'First

A'First(N)

A'First(N) denotes the lower
bound of the N-th index range; its type is the corresponding index type.

A'Last

A'Last(N)

A'Last(N) denotes the upper bound
of the N-th index range; its type is the corresponding index type.

A'Range

A'Range is equivalent to the
range A'First .. A'Last, except that the prefix
A is only evaluated once.

A'Range(N)

A'Range(N) is equivalent to the
range A'First(N) .. A'Last(N), except that the prefix
A is only evaluated once.

A'Length

A'Length denotes the number of
values of the first index range (zero for a null range); its type is
*universal_integer*.

A'Length(N)

A'Length(N) denotes the number
of values of the N-th index range (zero for a null range); its type is
*universal_integer*.

An implementation should normally represent multidimensional
arrays in row-major order, consistent with the notation used for multidimensional
array aggregates (see 4.3.3). However, if
convention Fortran is specified for a multidimensional array type, then
column-major order should be used instead (see B.5,
“Interfacing with Fortran”).

NOTE 1 The
attribute_references
A'First and A'First(1) denote the same value. A similar relation exists
for the attribute_references
A'Last, A'Range, and A'Length. The following relation is satisfied (except
for a null array) by the above attributes if the index type is an integer
type:

A'Length(N) = A'Last(N) - A'First(N) + 1

NOTE 2 An array type is limited if
its component type is limited (see 7.5).

NOTE 3 The predefined
operations of an array type include the membership tests, qualification,
and explicit conversion. If the array type is not limited, they also
include assignment and the predefined equality operators. For a one-dimensional
array type, they include the predefined concatenation operators (if nonlimited)
and, if the component type is discrete, the predefined relational operators;
if the component type is boolean, the predefined logical operators are
also included.

NOTE 4 A component of an array can
be named with an indexed_component.
A value of an array type can be specified with an array_aggregate.
For a one-dimensional array type, a slice of the array can be named;
also, string literals are defined if the component type is a character
type.

-- Filter'First = 0 Filter'Last = 31 Filter'Length = 32

-- Rectangle'Last(1) = 20 Rectangle'Last(2) = 30

-- Rectangle'Last(1) = 20 Rectangle'Last(2) = 30

Ada 2005 and 2012 Editions sponsored in part by **Ada-Europe**