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,247 of 33,346   
   Johannes Schaub to All   
   Re: Most-derived objects objects shall h   
   05 May 12 06:13:10   
   
   From: schaub.johannes@googlemail.com   
      
   Am 05.05.2012 02:36, schrieb Alf P. Steinbach:   
   > On 04.05.2012 22:06, Chris Uzdavinis wrote:   
   >> On May 3, 6:30 pm, "Alf P. Steinbach"> +use...@gmail.com> wrote:   
   >>   
   >>>> 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?   
   >>>   
   >>> The returned pointer is not a pointer to an object.   
   >>>   
   >>> It is just a unique pointer value.   
   >>   
   >> I don't think that is a valid summary. Allocating an array of size   
   >> zero returns a pointer to a memory object representing an array   
   >> with zero elements.   
   >   
   > No, it can't be an "object" in the standard's sense of "object". As   
   > Johannes noted in the original posting, such an object would have   
   > zero size, which by §1.8/5 is forbidden for a most derived object,   
   > unless that object is a bit field.   
   >   
      
   It says just as clear that "new" attempts to create an object of the   
   new-type-id. And that the type of that object is the allocated type.   
      
   Is it not a contradiction?   
      
      
   --   
         [ 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