[Lazarus] const array syntax
Jürgen Hestermann
juergen.hestermann at gmx.de
Tue Jan 12 17:32:19 CET 2010
> Paul Ishenin schrieb:
>> That's an issue, yes. Although, in this case the constant "auto" could
>> be independend from the keyword "auto". So it would not fail. Instead
>> constant and array size would not be related in any way (although it
>> appears like that).
> I can't. How compiler will decide whether this is a constant 'auto' or a
> keyword inside the const declaration?
Well, then it could be made that if the constant is defined, it would be used,
otherwise automatic caculation is used.
Nevertheless, even if it works it is not a good idea because it's confusing.
>>> I would go for
>>> arr: [1..] of Integer = (1, 2, 3);
> Maybe, but this can lead to ocasional errors. What if developer forgot
> to write the paticular value on which program execution depends.
Then a runtime error would occur. Currently you can forget to add a value *and* the upper bounds too.
> I would use arr[] of Integer as in C. This would also simplify code porting :)
I would not like to be forced using zero as starting index. If such changes are made
it should be more Pascal-like.
More information about the Lazarus
mailing list