[omniORB] Problem passing an array of structs

W T Meyer meyer at iastate.edu
Mon May 21 15:08:19 BST 2007


At 10:39 AM 5/19/2007, Duncan Grisby wrote:
>On Friday 18 May, W T Meyer wrote:
>
> > Since no one else responded, I'll answer my own question.  I know how
> > to get around the problem, but I don't understand why it is a problem.
> >
> > Apparently operator[] is overloaded in omniORB only for unsigned int.
> > When I changed the index variable i in line 90 from "int i" to
> > "unsigned int i" everything worked. The error message is somewhat less
> > than transparent in pointing to the problem.
> >
> > Is there a reason for requiring unsigned ints?  If so, is there a way
> > to give the hapless user a more helpful error message?
>
>The C++ mapping specifies that operator[] should be defined just for
>CORBA::ULong (see page 1-49 of the C++ 1.1 mapping).

Yes, and I now see that all the examples in my CORBA books use 
CORBA::ULONG for the index, but none of them says why, or that you 
have to.  Since many of us are used to using an int or a long for 
array indices in C++, it is a natural trap to fall into.  Few of us 
wade through the official CORBA binding to C++ - as you say in the 
omniORB docs, it's a tough read.

Even though the dense error message comes from the g++ compiler, is 
there more that can be done to make it easier for us that fall into 
this trap to figure it out?  It took me several frustrating weeks to 
get to the bottom of it. The lack of responses to my post made it 
that much harder. How about adding an FAQ, so a Google search on 
something like "omniORB worst conversion" turns up the answer?

Thanks for your help,

Tom Meyer


>The "error" is actually just a warning, and I don't think there's
>anything omniORB can do to make it clearer -- it's the C++ compiler that
>chooses its warning messages.
>
>Cheers,
>
>Duncan.
>
>--
>  -- Duncan Grisby         --
>   -- duncan at grisby.org     --
>    -- http://www.grisby.org --




More information about the omniORB-list mailing list