I was curious how long a dynamic array could be, so I tried
SetLength(dynArray, High(Int64));
This has a value of 9,223,372,036,854,775,807, and I believe that this will be the largest number of indexes that I could reference in any case. This gave me:
ERangeError with the message "Range check error".
So I tried:
SetLength(dynArray, MaxInt);
and got the same error!
I wonder what I could call him
SetLength(dynArray, Trunc(Power(2, 32));
Which is actually twice as much as MaxInt!
I tried
SetLength(dynArray, Trunc(Power(2, 63) - 1));
Same as High (Int64), and that didn't work either.
Except for continuing trial and error, does anyone know the maximum size? Does it depend on the size of the elements in the array?
I am using Delphi 2009. Will it be different for different versions (obviously, when Commadore comes out, it should be bigger!)