Contents | Prev | Next

4.1.2.2.44 -u* Trap use of undefined values

This command-line compiler option enables/disables checking for undefined values.

Syntax: -u[+|-]

Default: Enabled

Notes: When this option is enabled the compiler generates code which checks each time your program gets a value from a variable to make sure that the value is not undefined. If your program does get an undefined value from a variable then the code generated by the compiler will issue a run-time error message and terminate your program.

So for example if you compile and run the following program

   program bad(output);
   var
      r : real;
   begin
      writeln(r) (* The value of "r" is undefined *)
   end.

The program will terminate with a run-time error message because of the attempt to print the value of r which is undefined. Unfortunately not all variable accesses can be checked, checks are only made for accesses to variables of the following types:

Accesses to variables of types char, integer, record and set (Bit set representation) are not checked.

Checking for undefined values is performed as follows:

Contents | Prev | Next