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,759 of 33,346    |
|    Dave Harris to Francis Glassborow    |
|    Re: Cost of deleting a null pointer    |
|    21 Dec 11 03:10:52    |
      From: brangdon@cix.co.uk              francis.glassborow@btinternet.com (Francis Glassborow) wrote (abridged):       > I challenge the reader to come up with a legitimate implementation       > of the delete and delete[] expressions that does not first check for a       > null pointer.       >       > 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.              It could do the check multiple times, once for each destructor and once       in operator delete(). I believe that's how it was implemented in the       olden days. Constructors and destructors did the memory allocation and       deallocation, and were passed flags (or a non-null address) if they were       stack allocated. Separating memory management from       construction/destruction happened later (although before C++ was first       standardised). Even if my memory of old implementations is wrong, it       could be done like that and still conform.              -- Dave Harris, Nottingham, UK.                     --        [ 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