Pragma equivalent
#pragma object_model
Purpose
Sets the object model to be used for structures,
unions, and classes.
The
object models differ in the following areas:
- Layout for the virtual function table
- Virtual base class support
- Name mangling scheme
Syntax
Option syntax
.-classic-.
>>- -q--objmodel--=--+-ibm-----+-------------------------------><
Pragma syntax
.-classic-.
>>-#pragma--object_model--(--+-ibm-----+-----------------------><
+-pop-----+
'-)-------'
Defaults
-qobjmodel=classic
Parameters
- classic
- Uses the object model compatible with V3.6 of the IBM® C++ Compiler. This suboption can also be
specified using the legacy suboption name of -qobjmodel=compat,
but support for this legacy suboption name may be removed in future
releases of the compiler.
- ibm
- Uses the object model introduced with VisualAge® C++ V5.0. Objects compiled with
this object model will use less memory and have better performance
for deep inheritance with virtual bases.
- pop (pragma only)
- Discards the current pragma setting and reverts
to the setting specified by the previous pragma directive. If no previous
pragma was specified, reverts to the command-line or default option
setting.
Usage
All classes in the same inheritance
hierarchy must have the same object model.
Predefined macros
- __OBJECT_MODEL_CLASSIC__ is predefined to 1 when -qobjmodel=classic or #pragma
object_model(classic) is in effect (the default); otherwise, it
is undefined.
- __OBJECT_MODEL_IBM__ is predefined to 1 when -qobjmodel=ibm or #pragma
object_model(ibm) is in effect; otherwise, it is undefined.
Examples
To compile
myprogram.C with
the
ibm object model, enter:
xlc++ myprogram.C -qobjmodel=ibm