[fpc-pascal] Const Array Length (was Dynamic Array Length)
JoshyFun
joshyfun at gmail.com
Sat Jan 2 16:34:57 CET 2010
Hello FPC-Pascal,
Saturday, January 2, 2010, 4:01:35 PM, you wrote:
JM> In most cases it would be better if the compiler counted the number of
JM> elements. Only in few cases the programmer really wants to limit the number to
JM> some predefined value.
JM> The currently used syntax for const array is:
JM> const
JM> a: array[1..3] of string = ('aaa', 'bbb', 'ccc');
JM> Already years ago I proposed the following syntax in Delphi mailing list:
JM> const
JM> a: array of string = ('aaa', 'bbb', 'ccc');
From my point of view that's a dynamic array, if it looks like a
dynamic array ir should be a dynamic array.
Other pascals uses something like:
a: array[1..] or string = ('aaa', 'bbb', 'ccc');
or
a: array[..] or string = ('aaa', 'bbb', 'ccc');
I think that:
a: array[..n] or string = ('aaa', 'bbb', 'ccc');
is not allowed.
--
Best regards,
JoshyFun
More information about the fpc-pascal
mailing list