From: Paul Fredrickson (qmoto@dsl-only.net)
Date: Thu May 30 2002 - 17:08:37 EDT
You are correct, so the check is not necessary, but I think it would still
be good to use the macro because double-deleting a pointer is still not ok.
Using DELETEP(ptr) twice is fine. Then again, deleting from two independent
(unrelated?) places usually means there's an ownership problem.
----- Original Message -----
From: "Tomas Frydrych" <tomas@frydrych.uklinux.net>
To: "Paul Rohr" <paul@abisource.com>
Cc: <abiword-dev@abisource.com>
Sent: Thursday, May 30, 2002 11:23 AM
Subject: Re: DELETEP, FREEP, and friends
>
> > In short, the whole reason we created those macros was to ensure that
> > all delete, free, etc. calls did all of the nice null-sanity work
> > you'd usually want. Thus instead of typing the risky:
> >
> > delete m_pHeaderSL;
> >
>
> Correct me if I am mistaken, but the c++ operator is designed to
> handle NULLs, so it is not really necessary to this kind of a check;
> its a different story with free though, isn't it?
>
> > motto -- a little macro goes a long, long way
> a little macro can also obscure code an awfull "long" :-).
>
> Tomas
>
This archive was generated by hypermail 2.1.4 : Thu May 30 2002 - 17:06:34 EDT