-qoldpassbyvalue (C++ only)
Category
Pragma equivalent
#pragma pass_by_value
Purpose
Specifies how classes containing const or reference members are passed in function arguments.
The IBM® C++ Compiler V3.6 uses pass by value only if the class has no const or reference data members, and the copy constructor is trivial and the destructor is trivial. VisualAge® C++ V5.0 and later compilers use pass by value if the copy constructor is trivial and the destructor is trivial, regardless of const or reference data members. When -qoldpassbyvalue is in effect, the compiler uses the 3.6 behavior so that when a class containing a const or reference member is passed as a function argument, it is not passed by value. When -qnooldpassbyvalue is in effect, the compiler uses the new behavior so that when a class containing a const or reference member is passed as a function argument, it is passed by value.
The #pragma pass_by_value directive allows you greater control over this option for specific files or sections of source code.
Syntax
Option syntax .-nooldpassbyvalue-. >>- -q--+-oldpassbyvalue---+-----------------------------------><
>>-| Pragma syntax |------------------------------------------->< Pragma syntax |--#--pragma--pass_by_value--(--+-compat--+--)------------------| +-ansi----+ +-default-+ +-source--+ +-pop-----+ '-reset---'
Defaults
-qnooldpassbyvalue
Parameters
- compat (pragma only)
- Sets -qoldpassbyvalue for the code that follows it. This instructs the compiler to use the earlier behavior: when a class containing a const or reference member is passed as a function argument, it is not passed by value.
- ansi | default (pragma only)
- Sets -qnooldpassbyvalue for the code that follows it. This instructs the compiler to use the new behavior: when a class containing a const or reference member is passed as a function argument, it is passed by value.
- source (pragma only)
- Reverts to the setting specified by the command-line option; if no option has been specified, reverts to the default setting (-qnooldpassbyvalue).
- pop | reset (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
Use this option if you are linking to libraries compiled with IBM C++ Compiler V3.6 or earlier. Otherwise, functions that have const or reference class parameter types will give incorrect behavior when they are called from modules compiled with a later version of the compiler. Library headers compiled with IBM C++ Compiler V3.6 or earlier should be protected with the #pragma pass_by_value directive so that users of these libraries will get the correct calling convention for functions in those libraries that use class parameters.
Predefined macros
None.



