home bbs files messages ]

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

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

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

   Message 2,595 of 2,753   
   Hans-Peter Diettrich to All   
   Union C++ standard   
   25 Nov 21 11:11:04   
   
   From: DrDiettrich1@netscape.net   
      
   Can somebody explain why the access to members of a union is "undefined"   
   except for the most recently written member?   
      
   What can be undefined in a union of data types of the same typesize end   
   alignment? Any member written will result in a unique bit/byte pattern   
   in memory, whose reading may not make sense in a different type but   
   undoubtedly is well defined.   
      
   DoDi   
   [I think it's undefined in a standards sense.  In any individual   
   implementation the result is predictable, but it's not portable. -John]   
      
   --- 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