datamodel

C compilerC++ compiler

datamodel syntax

Read syntax diagramSkip visual syntax diagram#pragmadatamodel( P128LLP64pop )

Description

Specifies a data model to apply to a section of code. The data model setting determines the interpretation of pointer types in absence of an explicit modifier.

This pragma overrides the data model specified by the DTAMDL compiler command line option.

Parameters
P128, p128
The size of pointers declared without the __ptr64 keyword will be 16 bytes.
LLP64, llp64
The size of pointers declared without the __ptr128 keyword will be 8 bytes.
pop
Restores the previous data model setting. If there is no previous data model setting, the setting specifed by the DTAMDL compiler command line option is used.

Note on Usage

C++ compiler onlyThis pragma and its settings are case-sensitive when used in C++ programs.

Specifying #pragma datamodel(LLP64) or #pragma datamodel(llp64) has effect only when the TERASPACE(*YES) compiler option is also specified.

The data model specified by this pragma remains in effect until another data model is specified, or until #pragma datamodel(pop) is specified.

Example

This pragma is recommended for wrapping header files, without having to add pointer modifiers to pointer declarations. For example:
    // header file blah.h
    #pragma datamodel(P128)     // Pointers are now 16-byte
    char* Blah(int, char *);
    #pragma datamodel(pop)      // Restore previous setting of datamodel

You can also specify data models using the __ptr64 and __ptr128 pointer modifiers. These modifers override the DTAMDL compiler option, and the #pragma datamodel setting for a specific pointer declaration.

The __ptr64 modifier should only be used if the TERASPACE(*YES) compiler option is also specified. The __ptr128 modifier can be used at any time.

The following example shows the declarations of a process local pointer and a tagged space pointer:
    char * __ptr64   p;  // an 8-byte, process local pointer
    char * __ptr128  t;  // a 16-byte, tagged space pointer

For more information, see Using Teraspace in the ILE C/C++ Programmer's Guide, and Teraspace and single-level store in the ILE Concepts.