[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Seg Fault in KPanel /KDE_1_1_Branch (fwd)
From:       Harri Porten <porten () tu-harburg ! de>
Date:       1999-07-05 19:04:15
[Download RAW message or body]

Rik Hemsley wrote:
> 
> On 05-Jul-99 Stephan Kulow wrote:
> >  [...]
> > Well, delete [] 0 is very much legal. I don't know why people keep
> > on adding "if (ptr) delete ptr;" :(
> 
> void * c(0);
> delete c; // -> ok
> 
> void * d;
> delete d; // -> segfault
> 
> Answer: Because sometimes you're not sure if the pointer was initialised to 0.

But

 if(d) delete d;

wouldn't help you either in this case. That's what we where talking
about (and the posted patch *did* set the pointer to 0L ;)

Harri.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic