HP Pascal/iX Reference Manual (31502-90022)

11- 25
For forward and external declarations of routines, the options specified
on the forward or external routine declaration must match the options on
the formal declaration.
DEFAULT_PARMS.
Normally, all parameters appearing in a formal parameter list must be
present in every corresponding actual parameter list.
The routine option DEFAULT_PARMS allows parameters to be omitted from the
actual parameter list. The option specifies which parameters may be
omitted, and the default values that the omitted parameters will assume.
Syntax
The expression supplied in the DEFAULT_PARMS option must be assignment
compatible with the corresponding formal parameter type. The expression
must also be a constant expression. The only default value permitted for
VAR, ANYVAR, and PROCEDURE/FUNCTION parameters is NIL.
Because defaulted reference parameters (VAR, ANYVAR, PROCEDURE/ FUNCTION
parameters) cannot be examined (their value is NIL, which cannot be
'dereferenced'), the predefined function haveoptvarparm can be used to
determine if a reference parameter was supplied by the caller. See the
section "Predefined Routines" for more information.
Example
PROCEDURE proc( i : integer )
OPTION DEFAULT_PARMS( i := -1 );
BEGIN
...
END;
...
proc( 1 ); { value of parameter is 1 }
proc( ); { value of parameter defaulted to -1 }
proc; { value of parameter defaulted to -1 }
See the
HP Pascal/iX Programmer's Guide
or the
HP Pascal/HP-UX
Programmer's Guide
, depending on your implementation, for more details on
OPTION DEFAULT_PARMS.
EXTENSIBLE.
Normally, all parameters appearing in a formal parameter list must be
present in a corresponding actual parameter list.
The routine option EXTENSIBLE allows parameters to be omitted from the
end
of an actual parameter list. The option specifies the number of
non-extension parameters (those that
must
be supplied) in the actual
parameter list. The remaining trailing parameters may be omitted.