HP 3000 Manuals

STRINGTEMPLIMIT [ HP Pascal/iX Reference Manual ] MPE/iX 5.0 Documentation


HP Pascal/iX Reference Manual

STRINGTEMPLIMIT 

STRINGTEMPLIMIT is an HP Pascal Option.

The STRINGTEMPLIMIT option causes all temporary strings of unknown size
to be allocated a fixed maximum size.  Instead of being allocated in the
heap, the temporary string is allocated in the stack.

Syntax 

     $STRINGTEMPLIMIT integer$

Parameters 

integer       Maximum size in bytes of any string temporary that the
              compiler can not calculate at compile time.

              __________________________________________________________ 

              NOTE  This value must include the length word of the string
                    and any padding.

              __________________________________________________________ 

Default       0 (each request is allocated from the heap with the exact
              size required).

Location      Heading.

Example 

The following example shows two cases where the compiler can not
determine the size of a string at compile time.  For performance reasons,
the temporary string is allocated in the stack at a fixed maximum of 400
bytes.

     $STRINGTEMPLIMIT 400$
     program strings;
     type
        str80 = string[80];
     var
        s1 : str80;
        n  : integer;

        function f(var x : string) : str80;
           begin
              f := x + ':';         { size of x is unknown }
           end;

     begin
        n  := 40;
        s1 := strrpt('*',n);  { value of n is unknown }
        s1 := f(s1);
     end.



MPE/iX 5.0 Documentation