[fpc-pascal] Typed constant
Valdas Jankūnas
zmuogs at gmail.com
Sat Oct 25 12:17:14 CEST 2008
Jonas Maebe rašė:
>> MAX_LAIKO_JUOSTA_MINUTEMIS:
>> SmallInt=MAX_LAIKO_JUOSTA.Valanda*MinsPerHour+MAX_LAIKO_JUOSTA.Minute;
>>
>> I creating constant from a constant. But why I getting that error?
>
> Because a "typed constant" is a bad name chose by Borland for
> "initialised variable". And you cannot use variables (initialised or
> not) in constant expressions.
>
> With {$j-} typed constants become real constants (they cannot be changed
> anymore, unlike in the default {$j+} state), but even then the above
> probably won't work because while parsing the compiler directly writes
> the values of such constants/initialised variables in the assembler list
> rather than constructing some semantic entity which can be reused later
> (so the compiler has no way to retrieve the values of such constants
> when you try to reuse them later on).
OK. Thanks for explanation
--
Valdas Jankūnas
More information about the fpc-pascal
mailing list