HP Pascal/iX Programmer's Guide (31502-90023)

8- 4
.
.
END;
END; {p}
The procedure p must be recompiled, but the program oldprog need not be.
Its call to p is still legal, as is the call to p from the program
newprog:
PROGRAM newprog;
PROCEDURE p (n1,n2,e1,e2 : integer)
OPTION EXTENSIBLE 2;
EXTERNAL;
BEGIN
p(1,2,3,4);
END.
A call to a routine with an extensible parameter list contains a hidden
parameter. See Chapter 7 for details.
NOTE A routine with
n
extensible parameters is not the same as a
procedure with
n
parameters that does not have EXTENSIBLE, even if
the two procedures are otherwise identical. For example, these
procedures are not the same:
PROCEDURE proc (a,b : char) PROCEDURE proc (a,b : char);
OPTION EXTENSIBLE 2;
BEGIN BEGIN
END; END;
DEFAULT_PARMS
The DEFAULT_PARMS procedure option specifies default values to be
assigned to formal parameters when actual parameters are not passed to
them. If a nonextension parameter has a default value, its actual
parameter can be left out of the actual parameter list, and its default
value will be assigned to the formal parameter.
A default value must be a constant expression that is assignment
compatible with its parameter. The value
nil
is the only legal default
for a VAR, ANYVAR, function or procedure parameter.
Example
PROGRAM prog;
PROCEDURE p (a,b,c : integer)
OPTION DEFAULT_PARMS (b:=2,c:=3); {two have default values}
BEGIN
.
.
.
END;
BEGIN
p(10); {a:=10, b:=2 (default), c:=3 (default)}
p(10,20); {a:=10, b:=20, c:=3 (default)}
p(10,,30); {a:=10, b:=2 (default), c:=30}
p(); {illegal}
p(,20); {illegal}
END.
If an extension parameter has a default value, its actual parameter can
be left out of the middle or off the end of the actual parameter list.