-qobjmodel (C++ only)

Category

Portability and migration

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

Read syntax diagramSkip visual syntax diagram
Option syntax

                     .-classic-.   
>>- -q--objmodel--=--+-ibm-----+-------------------------------><

Read syntax diagramSkip visual syntax diagram
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

Examples

To compile myprogram.C with the ibm object model, enter:
xlc++ myprogram.C -qobjmodel=ibm