[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


SOMCheckEnvironment

Description:

Controls whether or not to perform SOM environment checking.

Compatibility:

This pragma is compatible with the following platform targets:

68K

PowerPC

NEC V800
Intel x86
MIPS
Embedded 68K

Prototype:
  #pragma SOMCheckEnvironment on | off | reset Remarks:

This pragma is only available for Mac OS using C++ code.

When the pragma SOMCheckEnvironment is on, the compiler performs automatic SOM environment checking. It transforms every IDL method call and new allocation into an expression which also calls an error-checking function. You must define separate error-checking functions for method calls and allocations. For more information on how to write these functions, see Targeting Mac OS.

For example, the compiler transforms this IDL method call:


SOMobj->func(&env, arg1, arg2) ;

into something that is equivalent to this:


( temp=SOMobj->func(&env, arg1, arg2),
  __som_check_ev(&env), temp ) ;

First, the compiler calls the method and stores the result in a temporary variable. Then it checks the environment pointer. Finally, it returns the method's result.

And, the compiler transforms this new allocation:


new SOMclass;

into something that is equivalent to this:


( temp=new SOMclass, __som_check_new(temp),
  temp);

First, the compiler creates the object and stores it in a temporary variable. Then it checks the object and returns it.

The PowerPC compiler uses an optimized error check that is smaller but slightly slower than the one given above. To use the error check show above in PowerPC code, use the pragma SOM-Call-Optimization, described in "SOM-Call-Optimization."

This pragma is ignored if the direct_to_SOM pragma, described in Targeting Mac OS is off.

This pragma corresponds to the Direct to SOM menu in the C/C++ Language Panel. Selecting On with Environment Checks from that menu is like setting this pragma to on. Selecting anything else from that menu is like setting this pragma to off. To check whether this option is on, use __option (RTTI), described in "Checking Options." By default, this pragma is on.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000