HP SunSoft Pascal 4.0 User Manual

Page 66

Advertising
background image

42

Pascal 4.0 User’s Guide

3

The compiler issues warnings at the end of the procedure where the record
variables are defined, that is, when some of the fields are definitely not set.
However, no warnings are issued if fields are used in the source before they are
initialized, as the control flow may be different.

In some cases, it is not possible to determine at compile time whether the fields
have actually been initialized. For example:

For the array variable

V

, whose elements are records, if any assignment of

the kind

V[i]:= X or V[i].F:= Y

occurs, the compiler considers the

corresponding fields of

V[i]

for all values of

i

to be initialized. If such a

field is used, but not set, it is denoted as

V[...].F

in the warning message.

All formal parameters are assumed to be initialized. Consequently, the
compiler does not perform any checking for these component fields.

With the

-Rw

option, the compiler takes into account built-in procedures which

initialize their argument variables, for example,

reset(f)

for the file buffer

variable

f^

and its components.

rewrite(f)

does not initialize

f^

. The

compiler also examines field handling inside

WITH

statements.

Use the

-Rw

option to check the use of “unsafe” variant records, such as the

assignment of a variant to a field, or the use of another field from a “parallel”
variant. These practices may result in runtime errors which are hard to find.

Note –

The

-Rw

option requires extra compile-time, and is, therefore,

recommended for use in debugging only.

Advertising