Freeing the contents of a union



Hi,

Suppose I have a union like this:

union Foo switch (long)
{
  case 0: long   num_val;
  case 1: string str_val;
  case 2: Object obj_val;
};


How do I overwrite its value without leaking? Calling Foo__freekids() can
easily segfault because if, for example, _d is 0 and num_val is something
like 5, Foo__freekids() will try to CORBA_free 0x05 as a string/object.


	Gergo

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus@cactus.rulez.org =---'
Mindennap egy alma = évi 365 alma!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]