ARG_PRESENT

ARG_PRESENT

The ARG_PRESENT function is useful in user-written procedures that need to know if the lifetime of a value they are creating extends beyond the current routine’s lifetime. This can be important for two reasons:

To avoid expensive computations that the caller is not interested in.

To prevent heap variable leakage that would result if the routine creates pointers or object references and assigns them to arguments that are not passed back to the caller.

Example

Suppose that you are writing an IDL procedure that has the following procedure definition line:

The intent of the RET_PTR keyword is to pass back a pointer to a new pointer heap variable. The following command could be used to avoid creating (and possibly losing) a pointer if no named variable is provided by the caller: