On 18 Jun 2009, at 08:51, Vincent Snijders wrote:
Graeme Geldenhuys schreef:
Hi,
Recently I learned that you can have writeable typed constants. That
sounds rather like an oxymoron to my. Writeable constants make no
sense,
is that then simply a variable? What is the use of a writeable typed
constant?
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.
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal