Initializing static variables
For
a variable that is allocated when the program is loaded, that is,
a static variable, which remains allocated throughout execution
of the program, any value specified in an INITIAL attribute is assigned
only once. (Static storage for fetched procedures is allocated and
initialized each time the procedure is loaded.)
If static variables are initialized using the INITIAL attribute,
the initial values must be specified as restricted expressions.
Extent specifications must be restricted expressions.
The restrictions on initializing static variables are as follows:
- STATIC ENTRY variables must have the LIMITED attribute (see LIMITED attribute).
- INITIAL is not allowed for static format variables.
- INITIAL is allowed for label variables that are not part of
structures or unions. In this case, the label variable gets the
CONSTANT attribute.
- INITIAL is not valid for AREA variables.
- Only one member of a static union can specify INITIAL.
- If a STATIC EXTERNAL item without the RESERVED attribute is
given the INITIAL attribute in more than one declaration, the value
specified must be the same in every case.
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)