[omniORB] Corba union waste of space?

Michael Teske subscribe at teskor.de
Fri Dec 5 10:08:02 GMT 2008


Hi!

Bruce Visscher wrote:
>> This seems like a bug (waste of space) to me or is there any reason that the
>> string members do not go into the union?
> 
> I think you answered your own question:
> 
>> (I suppose the
>> complex types are not allowed in a C++union?).

Yes, I fear so...

> But you indicate that:
> 
>> [...] orbacus [...] uses pointers here so they fit into the C++ union data type
> 
> For some reason I had thought that the space wasting implementation
> was somehow required by the standard but maybe not.
> 
> In C++ I find that I only occasionally wish I had some kind of
> discriminated union type ("plain ol;" unions are of course odious).
> Maybe that is because I can use polymorphism or generic programming as
> an alternative (or even casting through void*).  But since IDL doesn't
> have classes (an interface isn't quite the same thing) it does seems
> to come up more often.  However, I usually don't worry about wasting
> the space.  If you think about it, your example isn't as bad as it
> might seem at first.  It only "wastes" instances of the class
> String_member which are only going to have pointers and (maybe) ints
> in them.  The unbounded string data is on the heap.

In our case (we have more datatypes than in my example) it's 12 bytes (orbacus)
versus 172 bytes (omniorb), for an empty object.
But anyway the question is if it was such a great idea to use Corba datatypes for
internal storage.

> I suppose if IONA doesn't have a patent on this (it is obvious so it
> shouldn't) maybe someone could implement this if they wanted.

I'd like to try, I suppose it's omniidl where this is done, somewhere in the
python code?

Greetings,
  Michael



More information about the omniORB-list mailing list