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-20
Data Types
2. This example shows a function that passes along one of its optional parameters
only if an actual parameter is supplied.
_extensible foo (int, int, int);
_extensible void bar ( int i, int j) {
/* Pass a third argument of j to foo only if j is present.
*/
foo (10, 20, _optional (_arg_present (j), j ));
}
3. This example shows an incorrect usage of the _optional operator.
_extensible foo (int, int, int);
_extensible void bar (int i, int j) {
foo (10,
20,
/* Error! The _optional operator is not used as an
actual parameter. It is used in an expression
that is the actual parameter. */
(_optional (_arg_present (j), j) + 1));
}
Data Types
The native C and C++ compilers, the TNS C compiler, and the TNS C++ preprocessor
support the predefined data types described in the ISO/ANSI C standard. In addition,
HP has added three additional data types: decimal,long long and unsigned
long long. Table 2-4 summarizes the predefined data types.
Table 2-4. Predefined Data Types (page 1 of 2)
Long forms Abbreviated forms
bool
*
bool
char char
short, signed short, short int, or
signed short int
short
int, signed, signed int int
long, signed long, long int, or
signed long int
long
unsigned short or unsigned short
int
unsigned short
unsigned or unsigned int unsigned
unsigned long or unsigned long int unsigned long
unsigned long long int
unsigned long long
long long int long long
decimal decimal