C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

Data Model Pragmas
#pragma p32_shared and #pragma p64_shared
These pragmas apply to class, struct, or union definitions. For C, they affect pointers declared
as fields. For C++, they apply to pointers declared (implicitly or explicitly) as members, to function
parameters (including the implicit “this parameter) and to any pointers used in the member function
definitions.
It does not allow the components whose layout or size are not data model invariant. It means that,
long is disallowed as a component and any class, struct or union component must be
declared as either p32_shared or p64_shared.
These pragmas immediately precede the class, struct, or union definition. They are not
applied globally and to any textually nested class, struct, or union definitions. They are not
used as an argument to pragmas push or pop.
p32_shared
It indicates that within the definition, the unqualified pointer declarations are 32-bit pointers –
regardless of the data model. Any base class of a p32_shared class must also be a p32_shared
class.
p64_shared
It indicates that within the definition, the unqualified pointer declarations are 64-bit pointers –
regardless of the data model. Any base class of a p64_shared class must also be a p64_shared
class.
#pragma p32_shared Example
struct s0{
int *Ptr1; /* Size depends on data model. */
int _ptr32 *Ptr2; /* This is a 32-bit pointer. */
int _ptr64 *Ptr3; /* This is a 64-bit pointer. */
};
#pragma p32_shared
struct s1{
int *Ptr1; /* This is a 32-bit pointer. */
int _ptr32 *Ptr2; /* This is a 32-bit pointer. */
int _ptr64 *Ptr3; /* This is a 64-bit pointer. */
};
#pragma p32_shared
struct s2{
long field1; /* Error, long not allowed as a component. */
long *field2; /* Ok, this is a 32-bit pointer to a long. /
struct s0 S0; /* Error,not p32_shared or p64_shared. /
struct s1 S1; /* Ok. */
};
#pragma p64_shared Example
#pragma p64_shared
struct s1{
int *Ptr1; /* This is a 64-bit pointer. */
int _ptr32 *Ptr2; /* This is a 32-bit pointer. */
int _ptr64 *Ptr3; /* This is a 64-bit pointer. */
};
#pragma p64_shared
struct s2{
long field1; /* Error, long not allowed as a component. */
long *field2; /* Ok, this is a 64-bit pointer to a long. */
};
Data Model Pragmas 393