C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)
Considerations for the native compilers only:
• _extensible and _variable are treated the same; _variable is a synonym for
_extensible.
Considerations for the TNS compilers only:
• A function with no prototype declaration or definition under pragma OLDCALLS cannot
be _extensible.
Considerations for both the native and TNS compilers:
• _extensible and _variable attributes cannot be specified for the same function.
• C-style variable argument lists (...) are not allowed.
• A _variable attribute cannot be specified for a function that passes a structure by value.
• Returning structures by value is not allowed.
• In C++ these guidelines apply:
_variable functions can neither be overloaded nor have default parameters.◦
◦ _variable cannot be specified on global function templates, that is, function
templates that are not members of a class.
◦ _variable cannot be specified on template member functions, that is, the member
functions of a template class.
◦ _variable cannot be used on class member functions of any class.
Usage Guidelines for Attribute-Specifier Syntax
• The FUNCTION pragma is the preferred method for declaring external routines. For more
details, see the pragma FUNCTION (page 195) and Writing Interface Declarations (page 98).
• Programs that use this attribute-specifier syntax can be made portable by using macro
definitions in which the attribute-specifier keywords are replaced by nothing.
Examples
This function declaration declares a C or C++ function myproc, which is a TAL variable procedure
with the externally visible procedure name My^Proc:
_tal _variable _alias ("My^Proc") void myproc (short);
This example declares a function pointer pointing to a TAL integer extensible procedure:
_tal _extensible short (*tal_func_ptr)(void);
Pointer Modifiers
The _baddr, _far, _near, _procaddr, and _waddr pointer modifiers are HP extensions.
They have been added to TNS C and C++ because the TNS architecture has many pointer types,
and it is necessary that you have a way to designate what type of pointer is desired. For native C
and C++, these pointer modifiers have no effect. They are added to provide source-level
compatibility with TNS C and C++. Source-level compatibility involves only accepting syntactically
correct TNS programs, not diagnosing semantic violations with pointer modifier usage.
NOTE: The native compilers also recognize the _ptr32 and _ptr64 modifiers, for more
information see “LP64 Data Model” (page 391).
Pointer for C Programming Language
pointer:
[ modifier-list ] * [ type-qualifier-list ]
Pointer Modifiers 59