SPL to HP C/XL Migration Guide (30231-90001)
6-12
call. OPTION VARIABLE passed procedures require more work, including
the fabrication on the stack of a special mask word.
In HP C/XL, a function-id may be passed as an actual parameter. There
are no particular restrictions on the actual parameter list when the
passed function is called. For example,
main()
{
void callf(), calledf(); /* declares two functions */
callf(calledf); /* execute callf, passing calledf */
} /* end of main */
void callf(func) /* function to call a function */
void (*func)(); /* func is pointer to function returning void */
{
(void) func(); /* call the passed function */
} /* end of callf */
void calledf() /* function that will be passed */
{
printf("called calledf!\n");
} /* end of calledf */
For further information on OPTION VARIABLE cases, see "Missing Parame-
ters in Procedure Calls" above.
Subroutine Call Statement
SPL subroutines may be called from the procedures in which they are
declared.
HP C/XL does not allow nested functions. Subroutines must be converted
either to #define macro directives to generate code inline, or to
functions that may be callable by other functions. See "SUBROUTINE
Declaration" for further details.
The subroutine call itself may not require any modification at all. If
you use a #define macro directive, make sure the left parenthesis in both
the macro directive and the macro reference follows the identifier with
no spaces. e.g., "mysubcall( arg )".