Delphi has two completely separate array semantics that use the same code syntax array offor different purposes.
When array ofused to declare a data type or variable, it is used Dynamic Array, for example:
type
TIntegerArray: array of Integer;
var
Array1: TIntegerArray;
Array2: array of Integer;
In C ++, they correspond to a template class DynamicArray<T>, for example:
typedef DynamicArray<int> TIntegerArray;
TIntegerArray Array1;
DynamicArray<int> Array2;
, array of (.. typedef), Open Array, :
procedure DoSomething(Arr: array of Integer);
procedure DoSomethingElse(Arr: array of const);
, Open Array, , - . Delphi , :
DoSomething([12345, 67890]);
DoSomethingElse(['Hello', 12345, True]);
++, , , , , OPENARRAY() ARRAYOFCONST(), :
void __fastcall DoSomething(int const *Arr, const int Arr_Size);
void __fastcall DoSomethingElse(TVarRec const *Arr, const int Arr_Size);
DoSomething(OPENARRAY(int, (( 12345, 67890 )) );
DoSomethingElse(ARRAYOFCONST(( "Hello", 12345, true )) );