[omniORB] problem differentiating between Arrays and Sequences
Duncan Grisby
duncan at grisby.org
Tue Aug 11 15:27:11 BST 2009
On Thursday 30 July, Tim Black wrote:
> OK, thanks. I see that array-ness is specified in Declarator.sizes(). Is this
> the only place array-ness is specified? Is idltype.tk_array never used? I tend
> to use type.kind() to determine what kind of declaration I'm dealing with, so
> for example, I can treat an int struct member differently than an array struct
> member when I generate code.
idltype.tk_array is never used. It's there for consistency with TypeCode
kinds and in case a back-end wants to use it.
> It seems like I could just modify visitDeclarator() to set my visitor's
> self.__result_typekind = idltype.tk_array when it sees a declarator with len
> (sizes) > 0. I need to do something different to detect array-ness, because
> just visiting the type is not enough. Visiting the type just tells me what it
> is an array of. (Bc it seems the type objects know nothing about sizes.)
You can do that, but beware of IDL like this:
struct S {
long a, b[10], c[5][6];
};
There, you have a single type with three declarators, one of which is a
scalar, one a single-dimensional array, and the other a two-dimensional
array.
That kind of IDL is the reason array-ness is part of the declarator and
not the type.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list