[Ace-users] [tao-users] Is strdup required for return and out parameters

Tommy Persson tpe at ida.liu.se
Thu Oct 18 10:02:17 CDT 2007


Chris Cleeland <cleeland at ociweb.com> writes:

> On Oct 18, 2007, at 7:40 AM, Vikram Karandikar wrote:
> 
> > So either i should use strdup or CORBA::string_dup but stick to one.
> > am i right?
> 
> No, you should use only CORBA::string_dup() when duplicating CORBA
> strings.
> 
> Consult the Henning & Vinoski book suggested by Christian for details
> and further information.

I have read the book but totally misssed this. So could you indicate
where it is discussed or why?

In page 147 i says that

    char * p = CORBA::string_dup ("Hello");

is correct code but "Hello" is not a CORBA::String. And I routinely do
things like

   return CORBA::string_dup (res.c_str());

So what is the problem with this construction?

-- 
/Tommy Persson



More information about the Ace-users mailing list