On Fri, 2011-11-18 at 12:51 +0100, Bjoern Michaelsen wrote:
> > 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.
Ditto, the code should (ide
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 red
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 (
I have played with manual solving of this problem today... :-) There are
the more interesting examples:
- else if(pUserMarker)
+ else
{
delete pUserMarker;
pUserMarker = 0L;
}
and
- if( GetPageNum() > 0 && pCntntAnchor )
+ if( GetPageNum() > 0 )
{
delete pCntntAnchor;
Actually, c
On Wed, 2011-11-16 at 21:05 -0500, 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.
> > ?, convert all delete to e.g. DELETEZ, i.e. delete foo, foo = NULL ?
> > Wouldn't be a fa
On Wed, 2011-11-16 at 21:05 -0500, Andrew Douglas Pitonyak wrote:
> Setting a pointer to NULL after deleting the contents of the pointer is
> safe so that if you go to delete it again it is not a problem.
Safe if the variable that holds the pointer is likely to be accessed
again. If not, it's p
On 11/10/2011 05:14 AM, Caolán McNamara wrote:
On Wed, 2011-11-09 at 18:05 -0500, Andrew Douglas Pitonyak wrote:
I assume that this would check for an array as well.
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.
On Wed, 2011-11-09 at 18:05 -0500, Andrew Douglas Pitonyak wrote:
> I assume that this would check for an array as well.
>
> 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.
?, convert all delete to e.g. DELETEZ, i
On 11/07/2011 07:50 AM, Caolán McNamara wrote:
On Mon, 2011-09-19 at 20:58 +0200, Thomas Arnhold wrote:
Hi,
I've recently seen some changes, which removed unnecessary NULL checks
for delete commands with the form:
-if (pTextPContext)
-delete pTextPContext;
+delete pTextPContext
On Mon, 2011-09-19 at 20:58 +0200, Thomas Arnhold wrote:
> Hi,
>
> I've recently seen some changes, which removed unnecessary NULL checks
> for delete commands with the form:
>
> -if (pTextPContext)
> -delete pTextPContext;
> +delete pTextPContext;
>
> Codebase is full with thes
10 matches
Mail list logo