C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-38
FUNCTION
The extensible and variable attributes cannot both be specified for the same
function.
If you declare an external procedure as unspecified, the actual procedure
cannot be both written in C and compiled using the OLDCALLS pragma.
Unlike previous methods for declaring external functions, the FUNCTION pragma is
compliant with the ISO/ANSI C standard.
The language attribute tal identifies both TAL and pTAL procedures.
The param-count argument for the extensible attribute can be used only for
native C and C++ programs.
Cfront imposes these additional restrictions on the FUNCTION pragma:
°
It cannot be used for C++ functions or to change the language attribute.
°
It can be applied only to functions in the global scope.
°
No other pragmas can appear on the same line as a FUNCTION pragma.
°
The resident and alias attributes cannot be used.
C-style variable argument lists (...) cannot be used in variable and extensible
functions.
Extensible and variable functions in native C and C++ can have a maximum of 31
parameters.
Native C++ imposes these additional restrictions on the FUNCTION pragma:
°
Extensible and variable functions cannot be overloaded.
°
Extensible and variable functions cannot have default parameters.
°
Extensible and variable functions cannot be used in function templates and
member functions.
Examples
This example shows the declaration for the C function myproc, which is a TAL variable
procedure with the externally visible procedure name MY^PROC:
void myproc (int);
#pragma function myproc (tal, variable, alias("MY^PROC"))
/* function declaration */
void myproc (int x)
/* function definition */
{ if ( x >= 0 )
Positive(x);
else
Negative(x);
}