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

Table Of Contents
C and C++ Extensions
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
2-15
Pointer Modifiers
Usage Guidelines for Attribute-Specifier Syntax
The FUNCTION pragma is the preferred method for declaring external routines. For
more details, see the pragma FUNCTION on page 13-35 and Writing Interface
Declarations on page 7-3.
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.
Pointer for C Programming Language
type-qualifier-list is described in the ISO/ANSI C standard.
pointer:
[ modifier-list ] * [ type-qualifier-list ]
[ modifier-list ] * [ type-qualifier-list ] pointer
modifier-list:
modifier [ modifier-list ]
modifier:
_far | _near | _baddr | _waddr | _procaddr