Contents | Prev | Next

18.27 Invalid use of pack (1)

Official Description

6.6.5.4 For pack, it is an error if the parameter of ordinal-type is not assignment compatible with the index-type of the unpacked array parameter.

Simplified Description

In other words, the parameter used to specify the first element of the unpacked array to transfer to the packed array must be assignment compatible with the index type of the unpacked array. Or to put it another way the first element of the unpacked array to transfer to the packed array must exist. For example given:

var
   unpacked : array[1..10] of int;
   packed : packed array[21..30] of int;

then

   pack(unpacked, 0, packed);

is an error since 0 is not assignment compatible with 1..10. Or to put it another way element 0 of the unpacked array does not exist.

Error Handling

This error is always reported.

Contents | Prev | Next