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

C and C++ Extensions
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
2-3
Declarations
_lowmem
specifies that arrays and structures in the declaration are to be stored in the user
data space instead of the extended segment (only for TNS C and C++).
Consequently, _lowmem is useful only when compiling for the large-memory model
or the wide-data model. Note that you can use _lowmem alone, or you can specify it
after the auto, extern, or static storage-class specifiers.
The _lowmem storage class specifier is applicable only in the TNS environment. In
the native environment, _lowmem has no effect on code generation or the storage
of objects. It is supported to allow source-level compatibility with TNS C and C++.
Source-level compatibility involves only accepting syntactically correct TNS
programs, not diagnosing semantic violations with _lowmem usage.
Usage Guidelines for _lowmem
_lowmem cannot be used with the register storage-class specifier or with the
_cspace type qualifier.
_lowmem cannot be used with a formal parameter declaration or a function
declaration.
_lowmem cannot be used with a class or struct member unless the member is
static.
If you specify only _lowmem, the default storage classes apply:
°
Variables declared within function bodies and variables declared within blocks
have the default storage class auto.
°
Variables defined outside of a function have the default storage class extern.
°
Functions have the default storage class extern.
Examples
The following example shows how _lowmem affects allocation of data storage using the
large-memory model:
#pragma XMEM
static int x[5000];
static _lowmem int m[1000];
_lowmem struct triplet
{
int x,y,z;
} t1;
The pragma XMEM specifies compilation for the large-memory model. Thus, storage for
the array x is allocated in the extended segment. However, because the declarations
for the array m and the structure t1 specify _lowmem, storage for them is not allocated
in the extended segment. Instead, storage is allocated in the user data space.