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,748 of 33,346    |
|    Francis Glassborow to Dave Abrahams    |
|    Re: Cost of deleting a null pointer    |
|    19 Dec 11 12:12:34    |
   
   From: francis.glassborow@btinternet.com   
      
   On 19/12/2011 02:57, Dave Abrahams wrote:   
   > on Sun Dec 18 2011, Miles Bader wrote:   
   >   
   >> Francis Glassborow writes:   
   >>> I am virtually certain that there must be some other reason for the   
   >>   
   >>> 30x overhead. I cannot find any sane way in which an implementation   
   >>> can honour the requirement that delete applied to a null pointer is a   
   >>> no-op.   
   >> ...   
   >>> Note that operator delete() and operator delete[]() is not called till   
   >>> AFTER the dtor(s) are executed so the check needs to be part of the   
   >>> delete/delete[] expression.   
   >>   
   >> Very good point... I'm starting to think that the person who measured a   
   >> 30x speed-up must have simply made a mistake in his testing.   
   >   
   > Maybe his operator delete is a kernel call or something wacky like that.   
   >   
   But how would the delete expression ever call that delete operator on a   
   null pointer? Granted it would be a problem for explicit calls of   
   operator delete but that was not the case AFAIR.   
      
   Francis   
      
      
   --   
    [ 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