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

8- 5
If it is left out of the middle, its default value is assigned to the
formal parameter. If it is left off the end, no value is assigned to the
formal parameter.
Example
PROGRAM prog;
PROCEDURE p (a,b,c : integer)
OPTION EXTENSIBLE 0 {all parameters are extensible}
DEFAULT_PARMS (a:=1,b:=2,c:=3); {all have default values}
BEGIN
.
.
.
END;
BEGIN
p(9,,5); {a:=9, b:=2 (default), c:=5}
p(6,7); {a:=6, b:=7, no value assigned to c}
p(8); {a:=8, no value assigned to b or c}
p(,4,5); {a;=1 (default), b:=4, c:=5}
END.
Table 8-1 tells the value that is passed to a formal parameter,
x
,
when
x
is:
* Nonextension or extension.
* Its actual parameter is specified or not specified.
* It is before, the same as, or after the parameter
n
, where
n
is
the last parameter for which an actual parameter is specified.
Table 8-1. Values Passed to Formal Parameter x
------------------------------------------------------------------------------------------------
||| |
| Type of Parameter | Actual | Position of
x
informal parameter list
p(..,n,..)
|
| | Parameter | where
n
is the last actual parameter specified in |
| | for
x
is | the actual parameter list
p(..,n)
|
| | Specified | |
||| |
------------------------------------------------------------------------------------------------
| |||||
|||
x
is before
n
:|
x
is
n
:|
x
is after
n
:|
|||
p(.x.,n,..)
|
p(..,x,..)
|
p(..,n,.x.)
|
| |||||
------------------------------------------------------------------------------------------------
| |||||
| Nonextension | Yes | Actual value | Actual value | Impossible |
| Parameter | | | | becausex>n |
| |||||
------------------------------------------------------------------------------------------------
| |||||
| Nonextension | No | Default value if | Impossible | Illegal unless |
| Parameter | | specified; error | because x=n | defaulted, then |
| | | otherwise | | defaulted value |
| |||||
------------------------------------------------------------------------------------------------
| |||||
| Extension Parameter | Yes | Actual value | Actual value | Impossible |
| | | | | because x > n |
| |||||
------------------------------------------------------------------------------------------------
| |||||
| Extension Parameter | No | Default value if | Impossible | No value |
| | | specified; error | because x=n | |
| | | otherwise | | |
| |||||
------------------------------------------------------------------------------------------------