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

C and C++ Extensions
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
2-22
Data Types
data model, use the WIDE pragma. The WIDE pragma compiles only under the large-
memory model.
For TNS C, a C program runs under the large-memory model unless you have
specified the NOXMEM pragma.
For TNS C++, a C++ program always runs under the large-memory model. In addition,
the 32-bit (wide) data model is the default specification. If you want the size of the data
type int to be 16 bits, specify the NOWIDE pragma.
Table 2-5 shows the size of the short, int, and long types when you omit or specify
the WIDE pragma in TNS C.
For TNS C and C++, relative sizes of the types short, int, and long depend on
whether you compile the program under the 32-bit (wide) data model.
Without the 32-bit (wide) data model: With the 32-bit (wide) data model:
char < short = int < long char < short < int = long
For application portability and compatibility with native C and C++, use the 32-bit
(wide) data model whenever possible. For information on the WIDE pragma, see WIDE
on page 13-112. For information on the 32-bit (wide) data model, see Two Data
Models: 16-Bit and 32-Bit on page 19-9.
Table 2-5. Relationship Between WIDE Pragma and Types short, int, and long
Data Type
Size Without WIDE Pragma
Specified
Size With WIDE Pragma
Specified
int 16 bits 32 bits