[fpc-pascal] Writeable typed constants - what's the point?
jonas.maebe at elis.ugent.be
Thu Jun 18 10:56:26 CEST 2009
On 18 Jun 2009, at 08:51, Vincent Snijders wrote:
> Graeme Geldenhuys schreef:
>> Recently I learned that you can have writeable typed constants. That
>> sounds rather like an oxymoron to my. Writeable constants make no
>> is that then simply a variable? What is the use of a writeable typed
> Backwards compatibility with turbo pascal, which lacked initialized
> variables and writable constants were the alternative.
Writable constants behave completely different from initialised
variables inside procedures/functions: writable constants are
initialised once (at program startup) and keep their value across
invocations, while initialised variables are re-initialised every time
the procedure/function scope is entered.
I.e., local writable constants are basically global initialised
variables that are only visible inside a local scope.
More information about the fpc-pascal