[omniORB] FW: Sequence of Strings

Dee Jay Randall randal@cs.uregina.ca
Tue, 24 Nov 1998 10:33:13 -0600 (CST)


  I am pretty sure that you need to either declare pStr to be a constant
pointer to a char with 'const char * pStr = CORBA::string_dup("test");'
or cast it to a 'const char *'.

  In my experience, this would compile, but since it is assumed
that sequence items are allocated from the heap, I would get a
core dump if I did something like:

  myStringSeq strSeq;
  strSeq.length(1);
  strSeq[0] = "hello";
  strSeq[0] = "world";	// crashes here

  because as part of assigning "world" it would try to free/delete
"hello", which it of course cannot do.

  Is there any good documentation on this somewhere? I would like to
have a language reference that just listed all the functions and their
parameters, etc. Like man pages. As it is now, I think I learned how
to use sequences from the header file!

  Thanks, and hope that helps.

  Dee Jay Randall       _-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_
  randal@cs.uregina.ca  |  "While reality is neither black and white nor    |
                       { }  right and wrong, those are the only ideals     { }
   _-__-_  ouch,       { }  against which we can evaluate our decisions."  { }
  >      <  that hurt   |                                    -me            |
_)  chomp (___________  ~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~-_-~


On Tue, 24 Nov 1998, Tom Wnuk wrote:

> I hope this is the correct method to post a message to this list.
> I didn't receive any instructions yet.
> 
> When I perform the following:
> 
> IDL:
> Typedef sequence<string> myStringSeq;
> 
> Implementation:
> {
> 	...
> 	myStringSeq strSeq;
> 	strSeq.length(1);
> 
> 	char* pStr = CORBA::string_dup("test"); 
> 	
> 	strSeq[0] = pStr;	// Compile Error
> 				// no char* operand on right side of = (something like that)
> 
> I've tried all types of variations but am unable to get it to work
> correctly.  If I use *pStr I can compile but then I only get "" for data.
> 
> Thanks
> Tom
> 
> Tom Wnuk
> twnuk@earthlink.net
>