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

Table Of Contents
System-Level Programming
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
9-7
Converting Variable Functions to Extensible
Functions
extensible function is unnecessary, because native C and C++ treat functions declared
variable or extensible as extensible functions.
Converting a variable function to extensible is the only way to add parameters to the
function without recompiling all its callers. You can add new parameters at the time you
convert the function or later.
You can convert any variable function that meets these criteria:
It has at least one parameter.
It has no more than 16 words of parameters.
All parameters are one word long except the last, which can be one word or longer.
The size of a formal reference parameter is one word for the small-memory model and
two words for the large-memory model.
To convert an existing variable function to extensible, redeclare the function and add
these information:
Any new formal parameters
The keyword _extensible
The number of formal parameters in the variable function, specified as an int
value in the range 1 through 15 and enclosed in parentheses
This example converts a variable function to an extensible function and adds a new
formal parameter, p3. The value 2 in parentheses specifies that the function had two
formal parameters before it was converted.
_c _extensible (2) void errmsg (int p1, char *p2, int p3);
{
/* Lots of code */
}
Note. To convert a variable function into an extensible function, you must use the deprecated
syntax for writing function declarations. This syntax uses the _variable and _extensible
attributes described in Attribute Specifier on page 2-10. You cannot use the FUNCTION pragma
in this case. Isolate use of this deprecated declaration syntax.