On Fri, Nov 18, 2011 at 12:30:41PM +0100, Stephan Bergmann wrote:
On 11/10/2011 12:05 AM, Andrew Douglas Pitonyak wrote:
I would feel safer if pointers were set to NULL (or nullptr if we
support C++11) since it is not safe to delete a pointer twice.
I would rather argue that adding redundant "p = 0;" following a
"delete p;" makes our code worse, not better (even if that may sound
paradoxical at first):
[...]
I generally agree, but for debugging (non-product builds only) it might make
sense to mark a pointer as dead, to easier identify if the zombie pointer is
still dereferenced. But that should not be a NULL even in that case (which
might trigger overly defensive workarounds), rather something like 0xDEADBEEF.
Mind you: I am not talking about release builds.
Best,
Bjoern
Context
- Re: [Libreoffice] Remove NULL checks from delete (continued)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.