Declaration of Simple Variables

The PRIVATE and PUBLIC specifiers can only be used for simple variables that are declared within a structure block or a connection block. The PRIVATE specifier limits visibility of the simple variable to the scope of the structure block or the connection block. A PRIVATE simple variable cannot be accessed using a structure or connection block qualifier. The PUBLIC specifier allows the simple variable to be accessed using a structure or connection block qualifier. If neither PRIVATE nor PUBLIC is specified, the default value is PUBLIC and access to the simple variable using a structure or connection block qualifier is allowed.

A simple variable declared to be OWN retains its value when the program exits the block in which the variable is declared, and that value is again available when the program reenters the block in which the variable is declared.

The equation part causes the simple variable being declared to have the same address as the simple variable associated with the second identifier.

For more information on <equation part>, see BOOLEAN Declaration.

This action is called address equation. An identifier can be address-equated only to a previously declared local identifier or to a global identifier. The first identifier must not have been previously declared within the block of the equation part. An equation part is not allowed in the global part of a program unit.

Address equation is allowed only between integer, real, and Boolean variables. Because both identifiers of the equation part have the same address, altering the value of either variable affects the value of both variables. For more information, see Type Coercion of One-Word and Two-Word Operands.

The OWN specification has no effect on an address-equated identifier. The first identifier of an equation part is OWN only if the second identifier of the equation part is OWN.

If a real or integer value is assigned to a real variable, it is stored as is into the variable. If a double-precision value is assigned to a real variable, it is rounded to single-precision before it is stored in the variable.

When a real simple variable is allocated, it is initialized to 0 (zero), which is a 48-bit word with all bits equal to 0.

See Data Representation for additional information on the internal structure of a real operand.