[omniORB] problem differentiating between Arrays and Sequences

Duncan Grisby duncan at grisby.org
Thu Jul 30 17:19:35 BST 2009


On Wednesday 29 July, Tim Black wrote:

> sequence<long> UnboundLongs;
> sequence<long, 10> BoundLongs;
> 
> Arrays are fixed-length sequences, defined thusly:
> 
> long ExactlyTenLongs[10];
> 
> In omniIDL documentation, I can see that there is no mention of this
> fixed-length Array type. However, I can see that there is a type kind for
> arrays: idltype.tk_array. But when I visit an IDL array (e.g. ExactlyTenLongs
> above) in my back end, the type comes out looking like a bounded sequence,
> i.e. the type of the corresponding AST node is an instance of class Sequence,
> it's self.__kind is tk_sequence, not tk_array, and bound = 10. What gives?
> Does omniIDL not support the CORBA array construct?

What exactly does your IDL look like?  I don't know why you're meeting a
sequence unless you have an array of a sequence type.

Arrays are handled differently from sequences, because the semantics of
declaring them in IDL are different. Places you can use an array are a
Declarator, and the Declarator class has a sizes() method that returns a
list of array sizes. It's done that way to support nasty but valid IDL
like this:

  typedef long one, two[10], three[20][30];

It's documented (briefly) in the section about omniidl.idlast.Declarator.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list