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


3.6.2 Operations of Array Types

Legality Rules

  1. 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.

    Static Semantics

  2. 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:
  3. A'First
    A'First denotes the lower bound of the first index range; its
    type is the corresponding index type.
    
  4. A'First(N)
    A'First(N) denotes the lower bound of the N-th index range;
    its type is the corresponding index type.
    
  5. A'Last
    A'Last denotes the upper bound of the first index range; its
    type is the corresponding index type.
    
  6. A'Last(N)
    A'Last(N) denotes the upper bound of the N-th index range;
    its type is the corresponding index type.
    
  7. A'Range
    A'Range is equivalent to the range A'First .. A'Last, except
    that the prefix A is only evaluated once.
    
  8. 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.
    
  9. A'Length
    A'Length denotes the number of values of the first index
    range (zero for a null range); its type is universal_integer.
    
  10. 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.
    

    Implementation Advice

  11. An implementation should normally represent multidimensional arrays in row-major order, consistent with the notation used for multidimensional array aggregates, See section 4.3.3 Array Aggregates. However, if a pragma Convention(Fortran, ...) applies to a multidimensional array type, then column-major order should be used instead, See section B.5 Interfacing with Fortran.

    NOTES

  12. (45) 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:
  13. A'Length(N) = A'Last(N) - A'First(N) + 1
    
  14. (46) An array type is limited if its component type is limited, See section 7.5 Limited Types.
  15. (47) 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.
  16. (48) 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, unless the array type is limited. 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.

    Examples

  17. Examples (using arrays declared in the examples of subclause See section 3.6.1 Index Constraints and Discrete Ranges.):
  18. --  Filter'First       =   0
    --  Filter'Last        =  31
    --  Filter'Length      =  32
    --  Rectangle'Last(1)  =  20
    --  Rectangle'Last(2)  =  30
    


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