Go to the first, previous, next, last section, table of contents.

An array object is a composite object consisting of components which all
have the same subtype. The name for a component of an array uses one or
more index values belonging to specified discrete types. The value of an
array object is a composite value consisting of the values of the
components.
Syntax

array_type_definition ::=
unconstrained_array_definition  constrained_array_definition

unconstrained_array_definition ::=
array(index_subtype_definition {, index_subtype_definition})
of component_definition

index_subtype_definition ::= subtype_mark range <>

constrained_array_definition ::=
array (discrete_subtype_definition
{, discrete_subtype_definition}) of component_definition

discrete_subtype_definition ::= discrete_subtype_indication  range

component_definition ::= [aliased] subtype_indication
Name Resolution Rules

For a discrete_subtype_definition that is a range, the range shall
resolve to be of some specific discrete type; which discrete type shall
be determined without using any context other than the bounds of the
range itself (plus the preference for root_integer  See section 8.6 The Context of Overload Resolution.).
Legality Rules

Each index_subtype_definition or discrete_subtype_definition in an
array_type_definition defines an index subtype; its type (the index
type) shall be discrete.

The subtype defined by the subtype_indication of a component_definition
(the component subtype) shall be a definite subtype.

Within the definition of a nonlimited composite type (or a limited
composite type that later in its immediate scope becomes nonlimited 
See section 7.3.1 Private Operations, and See section 7.5 Limited Types.), if a component_definition contains the
reserved word aliased and the type of the component is discriminated,
then the nominal subtype of the component shall be constrained.
Static Semantics

An array is characterized by the number of indices (the dimensionality
of the array), the type and position of each index, the lower and upper
bounds for each index, and the subtype of the components. The order of
the indices is significant.

A onedimensional array has a distinct component for each possible index
value. A multidimensional array has a distinct component for each
possible sequence of index values that can be formed by selecting one
value for each index position (in the given order). The possible values
for a given index are all the values between the lower and upper bounds,
inclusive; this range of values is called the index range. The bounds of
an array are the bounds of its index ranges. The length of a dimension
of an array is the number of values of the index range of the dimension
(zero for a null range). The length of a onedimensional array is the
length of its only dimension.

An array_type_definition defines an array type and its first subtype.
For each object of this array type, the number of indices, the type and
position of each index, and the subtype of the components are as in the
type definition; the values of the lower and upper bounds for each index
belong to the corresponding index subtype of its type, except for null
arrays, See section 3.6.1 Index Constraints and Discrete Ranges.

An unconstrained_array_definition defines an array type with an
unconstrained first subtype. Each index_subtype_definition defines the
corresponding index subtype to be the subtype denoted by the
subtype_mark. The compound delimiter <> (called a box) of an
index_subtype_definition stands for an undefined range (different
objects of the type need not have the same bounds).

A constrained_array_definition defines an array type with a constrained
first subtype. Each discrete_subtype_definition defines the
corresponding index subtype, as well as the corresponding index range
for the constrained first subtype. The constraint of the first subtype
consists of the bounds of the index ranges.

The discrete subtype defined by a discrete_subtype_definition is either
that defined by the subtype_indication, or a subtype determined by the
range as follows:

If the type of the range resolves to root_integer, then the
discrete_subtype_definition defines a subtype of the predefined type
Integer with bounds given by a conversion to Integer of the bounds of
the range;

Otherwise, the discrete_subtype_definition defines a subtype of
the type of the range, with the bounds given by the range.

The component_definition of an array_type_definition defines the nominal
subtype of the components. If the reserved word aliased appears in the
component_definition, then each component of the array is aliased,
See section 3.10 Access Types.
Dynamic Semantics

The elaboration of an array_type_definition creates the array type and
its first subtype, and consists of the elaboration of any
discrete_subtype_definitions and the component_definition.

The elaboration of a discrete_subtype_definition creates the discrete
subtype, and consists of the elaboration of the subtype_indication or
the evaluation of the range. The elaboration of a component_definition
in an array_type_definition consists of the elaboration of the
subtype_indication. The elaboration of any discrete_subtype_definitions
and the elaboration of the component_definition are performed in an
arbitrary order.
NOTES

(41) All components of an array have the same subtype. In particular,
for an array of components that are onedimensional arrays, this means
that all components have the same bounds and hence the same length.

(42) Each elaboration of an array_type_definition creates a distinct
array type. A consequence of this is that each object whose
object_declaration contains an array_type_definition is of its own
unique type.
Examples

Examples of type declarations with unconstrained array definitions:

type Vector is array(Integer range <>) of Real;
type Matrix is array(Integer range <>, Integer range <>)
of Real;
type Bit_Vector is array(Integer range <>) of Boolean;
type Roman is array(Positive range <>) of
Roman_Digit;  See section 3.5.2 Character Types

Examples of type declarations with constrained array definitions:

type Table is array(1 .. 10) of Integer;
type Schedule is array(Day) of Boolean;
type Line is array(1 .. Max_Line_Size) of Character;

Examples of object declarations with array type definitions:

Grid : array(1 .. 80, 1 .. 100) of Boolean;
Mix : array(Color range Red .. Green) of Boolean;
Page : array(Positive range <>) of Line :=  an array of arrays
(1  50 => Line'(1  Line'Last => '+', others => ''),
 See section 4.3.3 Array Aggregates
2 .. 49 => Line'(1  Line'Last => '', others => ' '));
 Page is constrained by its initial value to (1..50)
 3.6.1: Index Constraints and Discrete Ranges
 3.6.2: Operations of Array Types
 3.6.3: String Types
Go to the first, previous, next, last section, table of contents.