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 31,985 of 33,346   
   Seungbeom Kim to Andrea Venturoli   
   Re: Incomplete class with auto_ptr   
   03 Mar 12 12:11:27   
   
   From: musiphil@bawi.org   
      
   On 2012-03-02 12:29, Andrea Venturoli wrote:   
   > On 02/29/12 12:58, Kris Prad wrote:   
   >   
   >> Eventually ~auto_ptr() must see the underlying class definition for   
   >> the code to work correctly.   
   >   
   > AFAIK, this is true only if the underlying class has a non trivial   
   > destructor or overrides delete.   
      
   So in this case, I guess, the compiler just skips the calls to the   
   destructor and calls the global deallocation function, assuming that   
   the class has a trivial destructor and doesn't have a class-specific   
   deallocation function... and gives you a warning.   
      
   It would have been better if the warning had stated the assumption, as:   
      
   "warning: delete of pointer to incomplete class, correct only if   
   the class has a trivial destructor and doesn't have a class-specific   
   deallocation function"   
      
   ... eh, but this is too long. :)   
      
   --   
   Seungbeom Kim   
      
      
         [ 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