When you declare routines that
take array parameters, you cannot include index type specifiers in the
parameter declarations. That is, the declaration
procedure
Sort(A: array[1..10] of Integer); // syntax error
causes a compilation error. But
type
TDigits = array[1..10] of Integer;
procedure
Sort(A: TDigits);
is valid. For most purposes, however, open array parameters are a better solution.
Procedures and functions: Overview
声明接受数组参数的例程时,不能在参数声明中包括索引类型说明。简言之,下面的声明
procedure
Sort(A: array[1..10] of Integer); //语法错误
将导致编译错误。而下面的声明
type
TDigits = array[1..10] of Integer;
procedure
Sort(A: TDigits);
则是有效的。然而,对于大多数用途,开放数组参数是较好的解决办法。