ILE C/C++ Compiler Reference


datamodel

                            .-P128--.
>>-#--pragma--datamodel--(--+-LLP64-+--)-----------------------><
                            '-pop---'
 
 

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
Default setting. If specified, sizes of int, long, and pointer types in program code following this pragma are 4, 4, and 16 bytes respectively, until another pragma datamodel setting is specified. If the RTBND(*LLP64) option is in effect, pointer types in code sections affected by this pragma will be 8 bytes in size.

LLP64, llp64
If specified, sizes of int, long, and pointer types in program code following this pragma are 4, 4, and 8 bytes respectively, until another pragma datamodel setting is specified.

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

This 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 WebSphere Development Studio: ILE C/C++ Programmer's Guide, and Teraspace and single-level store in ILE Concepts.


[ Top of Page | Previous Page | Next Page | Table of Contents ]