home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 134,270 of 135,536   
   rbowman to John Levine   
   Re: C structure portability, naughty Pyt   
   03 Jan 26 00:08:34   
   
   XPost: alt.folklore.computers   
   From: bowman@montana.com   
      
   On Fri, 2 Jan 2026 20:32:53 -0000 (UTC), John Levine wrote:   
      
   > C doesn't have variant records, but you can fake them with structures   
   > with common initial fields.  The different structures can be different   
   > sizes so the usual approach is to malloc() them one at a time and use a   
   > pointer to it.   
      
   Another approach is to have a struct containing union of structs with a   
   flag in the top level struct indicating which child struct to use in the   
   union. The structs in the union can also have unions so you can build a   
   real octopus.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca