[omniORB] Problems with method returning a complex
structure
Duncan Grisby
dgrisby@uk.research.att.com
Mon, 03 Jul 2000 17:47:05 +0100
On Monday 3 July, Andy Weber wrote:
> Is there any *essential* difference between Sai-Lai Lo's recommendation:
> > updates_var Result = new updates();
> ....
> > return Result._retn();
> and Duncan Grisby's (which was my original attempt):
> > updates *Result; // has to be new'd!!
> > ...
> > return Result;
Sai-Lai's suggestion is better. The _var type means that if something
throws an exception between the construction of the result, and the
return statement, the result is automatically deleted as the exception
is propagated. In the non-_var case, the instance would be leaked.
Cheers,
Duncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --