CORBA style was: [omniORB] CORBA::string_alloc(len) problem

Doug Anderson doug@clark.net
Fri, 16 Jul 1999 08:29:27 -0400


I believe you can also do the following and consume it:

CORBA::String_var SomeString = (char *)string_alloc(100);
SomeString[0] = 'f';
SomeString[1] = 'o';
SomeString[2] = 'o';
SomeString[3] = '\0';

If the cast were (const char *), it would deep copy the alloc.
Please correct me if I'm wrong.  I seem to remember seeing
this somewhere.
Doug

> String_var::operator = (String_var&)
> 
> And thus we *copy* the string rather than consume it.
> 
> > Then I can't see what is wrong with doing
> > String_var SomeString = string_alloc(100);
> > char *ptr = SomeString;
> > ptr[0] = 'f';
> > ptr[1] = 'o';
> > ptr[2] = 'o';
> > ptr[3] = 0;
> > 
> > Please correct me if I'm missing something here :-)
> > 
> > bjornw>
> > 
>