home bbs files messages ]

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

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

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

   Message 243,006 of 243,242   
   James Russell Kuyper Jr. to Michael S   
   Re: UB or not UB? was: On Undefined Beha   
   13 Jan 26 22:19:23   
   
   From: jameskuyper@alumni.caltech.edu   
      
   On 2026-01-12 13:08, Michael S wrote:   
   > On Mon, 12 Jan 2026 15:58:15 +0000   
   > bart  wrote:   
   ...   
   >> struct bar1 {   
   >> union {   
   >> struct {   
   >> int table[4];   
   >> int other_table[4];   
   >> };   
   >> int xtable[8];   
   >> };   
   >> };   
   ...   
   >> I'm not even sure about there being no padding between .table and   
   >> .other_table.   
   >   
   > Considering that they both 'int' I don't think that it could happen,   
   > even in standard C.   
      
   "Each non-bit-field member of a structure or union object is aligned in   
   an implementation-defined manner appropriate to its type." (6.7.3.2p16)   
   "... There can be unnamed padding within a structure object, but not   
   at its beginning." (6.7.3.2p17)   
      
   While I can't think of any good reason for an implementation to insert   
   padding between those objects, it would not violate any requirement of   
   the standard if one did.   
      
   --- 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