Contents | Prev | Next

5.1.2.2.40 -s* Strict var strings

This command-line compiler option enables/disables strict checking of var string parameters.

Syntax: -s[+|-]

Default: Enabled

Notes:

When strict checking is enabled, it is an error to pass a string variable by reference if the length of the variable's string type is not equal to the length of the formal parameter's string type.

When strict checking is disabled you can pass a string variable by reference even if the length of the string variable is not equal to the length of the formal parameter.

For example if you compile the following program and strict checking is enabled:

   program p(output);
   type
      string16 = string[16];
      string8 = string[8];
   var
      x : string16;
      procedure print(var s : string8);
      begin
         writeln(s)
      end;
   begin
      x := 'Hello';
      print(x)          (* Error only if strict checking is enabled *)
   end.

then the compiler will report an error with the call print(x) since the length of x's string type is 16 and the length of the formal parameter's sting type is 8 (i.e. they are not equal).

If strict checking is disabled then no errors are reported.

Contents | Prev | Next