Invalid use of pack (3)

Official Description For pack, it is an error if the index-type of the unpacked array is exceeded.

Simplified Description

In other words, it is an error if the pack procedure attempts to transfer array elements from the unpacked array that do not exist. For example given:

   unpacked_value : array[1..10] of integer;
   packed_value : packed array[21..30] of integer;


   pack(unpacked_value, 2, packed_value);

means that the pack procedure should attempt to transfer ten elements from the unpacked array (since the packed array has ten elements), starting with the element two. So the pack procedure should transfer elements 2-11 from the unpacked array, but the unpacked array does not have an element 11.

Error Handling

This error is always reported.