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

Running and Debugging C and C++ Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
19-10
Converting Programs to the 32-Bit Data Model
Note that the small-memory model and the 32-bit data model cannot be selected
together.
The default memory and data models used by the C compiler are determined by the
environment in which the C compiler runs and the SYSTYPE pragma setting, as shown
in Table 19-5, Default Memory and Data Models, on page 19-10. (The SYSTYPE
pragma determines whether a program’s target is the Guardian or OSS environment.)
To change the default settings, specify any valid combination of the XMEM, NOXMEM,
WIDE, and NOWIDE pragmas.
The C compiler running in the OSS environment supports only the large-memory
model and 32-bit data model.
The memory model and data model selected determines the model-dependent library
file that you bind into a program. For more information, see Section 14, Compiling,
Binding, and Accelerating TNS C Programs, and Section 15, Compiling, Binding, and
Accelerating TNS C++ Programs.
Converting Programs to the 32-Bit Data Model
HP strongly recommends that you convert your TNS C and C++ programs from the
16-bit data model to the 32-bit (or wide) data model. The native C and C++ compilers
do not support the 16-bit data model. The following list provides guidelines for this
conversion using the TNS C compiler and Cfront:
Compile your program using the STRICT pragma.
Table 19-4. Relationship Between Memory Models and Data Models
Memory
Model Data Model
C Compiler
Pragmas
Size of
Pointer Size of Type int
Small 16-bit NOXMEM, NOWIDE 16-bit 16 bits
Small 32-bit or wide Not available 16-bit 32 bits
Large 16-bit XMEM, NOWIDE 32-bit 16 bits
Large 32-bit or wide XMEM, WIDE 32-bit 32 bits
Table 19-5. Default Memory and Data Models
Compiler
Environment SYSTYPE Pragma
Memory
Model
Data
Model
Pragma
Settings
Guardian GUARDIAN Large 16-bit XMEM, NOWIDE
Guardian OSS Large 32-bit XMEM, WIDE
OSS GUARDIAN Large 32-bit XMEM, WIDE
OSS OSS Large 32-bit XMEM, WIDE