Delphi Compiler Error
E2193 Slice standard function only allowed as open array argument
Reason for the Error & Solution
An attempt has been made to pass an array slice to a fixed size array. Array slices can only be sent to open array parameters. none
program Produce; type IntegerArray = array [1..10] OF Integer; var SliceMe : array [1..200] OF Integer; procedure TakesArray(x : IntegerArray); begin end; begin TakesArray(SLICE(SliceMe, 5)); end.
In the above example, the error is produced because TakesArray expects a fixed size array.
program Solve; type IntegerArray = array [1..10] OF Integer; var SliceMe : array [1..200] OF Integer; procedure TakesArray(x : array of Integer); begin end; begin TakesArray(SLICE(SliceMe, 5)); end.
In the above example, the error is not produced because TakesArray takes an open array as the parameter.