SPL to HP C/XL Migration Guide (30231-90001)
6-9
Procedure Call Statement
Table 6-13. Procedure Call Statement
---------------------------------------------------------------------------------------------
|| |
| SPL | HP C/XL Equivalent |
|| |
---------------------------------------------------------------------------------------------
|| |
|
procedure-call-statement
:|
function-call-statement
:|
|| |
|1.
procedure-id
|1.
function-id
(); |
|| |
|2.
procedure-id
() | 2.
function-id
(); |
|| |
|3.
procedure-id
(
actual-parm
[,...] )| 3.
function-id
(
actual-parm
[,...] );|
|| |
---------------------------------------------------------------------------------------------
|| |
| A procedure call causes a control transfer | Same as SPL, using a function call. |
| to a procedure, supplying any required | |
| parameters. | As shown in format 1, HP C/XL requires the |
| | parentheses even if there are no actual |
| Formats 1 and 2 are equivalent. | parameters. |
|| |
---------------------------------------------------------------------------------------------
|| |
|
actual-parm
:|
actual-parm
:|
|| |
|a.
simple-variable-id
| a-r. &
simple-variable-id
|
| | a-v.
simple-variable-id
|
|b.
array/pointer-id
| b-r.
array/pointer-id
|
| | b-v.
array/pointer-id "
[
"
0
"
]
"
|
|c.
procedure-id
| c-r.
function-id
|
|d.
entry-id
| d-r.
(No equivalent; must be recoded)
|
|e.
label-id
| e-r.
(No equivalent; must be recoded)
|
|f.
array/pointer-id
(
index
) | f-r. &
array/pointer-id "
[
" index "
]
"
|
| | f-v.
array/pointer-id "
[
" index "
]
"
|
|g.
arithmetic-expression
| g-v.
arithmetic-expression
|
|h.
logical-expression
| h-v.
logical-expression
|
|i.
assignment-statement
| i-v.
assignment-expression
|
|j.* |j.
(No equivalent; must be recoded)
|
|| |
---------------------------------------------------------------------------------------------
|| |
| Parameter formats a, b, and f may be | Parameter formats marked with "-r" are |
| pass-by-reference or pass-by-value. Their | pass-by-reference. Formats marked with |
| pass-by-value use is also included in | "-v" are pass-by-value. In HP C/XL, while |
| formats g and h. Formats c, d, and e are | all parameters are pass-by-value, |
| pass-by-reference only. Formats g, h, and | pass-by-reference is achieved by passing a |
| i are pass-by-value only. Format j may be | pointer value to a pointer parameter. |
| either. | Function-ids are passed as pointers; |
| | unsubscripted array-ids are passed as |
| | pointers to their first elements. Array, |
| | pointer, and function formal parameters |
| | expect pointer actual parameters. |
|| |
---------------------------------------------------------------------------------------------
|| |
| Whether an
actual-parm
is pass-by-value or | Similar to SPL, except that HP C/XL |
| pass-by-reference depends on the definition | performs no type checking whatsoever. |
| of the procedure. SPL performs strict | |
| type-checking to ensure that parameters | The programmer must ensure that pointers |
| match. | are passed to pointers, integers are passed |
| | to integers, and reals are passed to reals. |
| | Note that all char, enum, and int types are |
| | expanded to [unsigned] long int types, and |
| | float is expanded to double when the actual |
| | parameters are evaluated. The passed long |
| | int, double, and pointer values are |
| | converted to the declared formal type when |
| | they are received by the function. |
|| |