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-8
Declarations
struct-or-union-specifier, enum-specifier, and typedef-name
are described in the ISO/ANSI C standard.
Usage Guidelines
If _cc_status is used as the return type for a function declaration, the language
specifier, if used, must be one of _c, _tal, or _unspecified.
The tal.h header contains three macros that interrogate the results of a function
declared with the _cc_status type specifier. These macros are:
°
For native C and C++:
#define _status_lt(x) ((x) < 0)
#define _status_eg(x) ((x) == 0)
#define _status_gt(x) ((x) > 0)
°
For TNS C and C++:
#define _status_lt(x) ((x) == 2)
#define _status_eg(x) ((x) == 1)
#define _status_gt(x) ((x) == 0)
The tal.h header for TNS C and C++ still supports the CCL, CCE, and CCG macros.
These macros have these meaning:
For more details on using _cc_status, see Section 7, Mixed-Language
Programming for TNS Programs, or Section 8, Mixed-Language Programming for
TNS/R and TNS/E Native Programs.
Examples
This example shows the difference between using the new macros defined at the D40
release and those used prior to the D40 release to examine _cc_status.
_tal _extensible _cc_status READX ( ... );
#include <tal.h>
...
_cc_status cc;
cc = READX ( ... );
/* Pre-D40 method */
if (cc == CCL) {
...
} else if (cc == CCG) {
...
}
CCL
Condition-code register less than zero
CCE
Condition-code register equal to zero
CCG
Condition-code register greater than zero