2.2 Typed constants

Typed constants serve to provide a program with initialised variables. Contrary to ordinary constants, a value can be assigned to them at run-time. Their definition is quite simple:

_________________________________________________________________________________________________________Typed constant declaration
 typed constant declaration--identifier- :-type- = -typed constant -hintdirective -;---
                       ------------------------------------------------|
-----------------------------------------------------------------

--typed constant -|-----constant-------------------------------------
               ---address constant---|
               ---array constant ---|
               -prroeccoedrudr caoln costnasnttant-|
___________________________________________________________________

This is an old concept from Turbo Pascal, which has been replaced with support for initialized variables: For a detailed description, see section 4.4, page 171.

Support for typed constants is controlled by the {$J} directive: it can be switched off, but is on by default (for Turbo Pascal compatibility). Initialized variables are always allowed.

Remark: It should be stressed that typed constants are initialized at program start. This is also true for local typed constants. Local typed constants are also initialized at program start. If their value was changed during previous invocations of the function, they will retain their changed value, i.e. they are not initialized each time the function is invoked.