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,260 of 33,346   
   Asger Joergensen to PiotrN   
   Re: Explicit destructor call - problem w   
   09 May 12 20:15:26   
   
   50876cc6   
   From: Junk@Asger-P.dk   
      
   Hi PiotrN   
      
   PiotrN wrote:   
      
   > Hello,   
   >   
   > Two questions:   
   >    1)  Why I cannot call destructor for builtin types like int:   
   >            int a;   
   >            int* p = new int[7];   
   >            p->~int();   
      
   You never call the destructor directly you use delete instead:   
      
   int* p = new int[7];   
      
   ....do some work   
      
   delete[] p;   
      
   In general every new should be matched by a delete and every   
   new xxx[] should be matched by a delete[].   
      
   Best regards   
   Asger-P   
   http://Asger-P.dk/software   
   Quick Launch is a must try.   
      
   --- 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