home bbs files messages ]

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

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

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

   Message 32,224 of 33,346   
   Pete Becker to red floyd   
   Re: Union padding   
   30 Apr 12 21:35:01   
   
   From: pete@versatilecoding.com   
      
   On 2012-04-30 22:42:57 +0000, red floyd said:   
      
   > On 4/30/2012 1:08 PM, Daryle Walker wrote:   
   >>   
   >> I've been testing out types like:   
   >>   
   >> union   
   >> {   
   >> T1  a;   
   >> T2  b;   
   >> union   
   >> {   
   >> T3 ca;   
   >> T4 cb;   
   >> }  c;   
   >> }  d;   
   >>   
      
   >> [redacted]   
   >> Looking at Section 9.5 Paragraph 1 in the copy of C++11 I just   
   >> bought, and it seems that my desired behavior isn't guaranteed.   
   >> There may be padding between the start of the union and any of its   
   >> members, and the padding for each member may differ.  Am I accurate   
   >> in this assessment?   
   >>   
   > From N3242.  9.5/5 The final sentence of the example implicitly   
   > notes that union members all have the same address.  I'm not sure if   
   > this is normative or not.   
      
   Examples and notes are not normative.   
      
   --   
      Pete   
   Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The   
   Standard C++ Library Extensions: a Tutorial and Reference   
   (www.petebecker.com/tr1book)   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- 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