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,238 of 33,346   
   Johannes Schaub to All   
   Most-derived objects objects shall have    
   03 May 12 14:25:04   
   
   From: schaub.johannes@googlemail.com   
      
   The C++11 spec says at 1.8p5   
      
   "Unless it is a bit-field (9.6), a most derived object shall have a   
   non-zero size and shall occupy one or more bytes of storage. Base class   
   subobjects may have zero size."   
      
   The following is supposed to be valid   
      
       int *x = new int[0];   
      
   The object created by "new int[0]" has zero size (int[0] == 0 *   
   sizeof(int)), but that contradicts the above quote.   
      
   How is this to be interpreted?   
      
      
   --   
         [ 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