C/C++ Programmer's Guide (G06.25+)

C and C++ Extensions
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
2-11
Declarations
Considerations for Both Native and TNS Compilers
Only one language specifier can be specified for a function.
The language specifier is allowed only in function declarations, function
definitions, and function pointer declarations. However, _cobol, _fortran,
_pascal, _tal, and _unspecified are not allowed in function definitions. _c
is allowed in a function definition only if the language being compiled is C.
For C++, a language specifier is not allowed on overloaded functions, member
functions, function templates, inline functions, or functions with default
arguments.
For a function with C-style variable argument lists, the only explicit language
attribute allowed is _c.
The language specifier _unspecified indicates that the language is unknown
and unspecified.
attribute
specifies a function attribute.
Considerations for Both the Native and TNS Compilers
An attribute is allowed only in function declarations, function definitions,
and function pointer declarations.
The same attribute is not allowed to appear more than once in a function
declaration.
In C++, attributes on virtual functions are not inherited.
A function is allowed to have multiple declarations. If the multiple declarations
are incompatible, an error message is generated. If the declarations are
compatible, then the attribute values are “unioned.” Two declarations for a
function are deemed to agree, with respect to the attributes, if:
°
Either both or neither are specified to be _extensible.
°
Either both or neither are specified to be _variable.
°
If both have a language-specifier, they must either specify the same
language or one language-specifier must be _unspecified.
°
They do not result in any illegal combination as is discussed under the
following attribute syntax descriptions.