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

List:       kde-core-devel
Subject:    Re: qt-copy doesn't compile
From:       Allan Sandfeld Jensen <snowwolf () one2one-networks ! com>
Date:       2002-03-10 15:51:31
[Download RAW message or body]

On Friday 08 March 2002 17:04, Michael Matz wrote:
> Hi,
>
> On Fri, 8 Mar 2002, Allan Sandfeld Jensen wrote:
> > > I don't believe that there is any difference between delete [] and
> > > delete for builtin types.
> >
> > There is... delete[] needs to handle the case where someone has
> > incremented the array pointer.
>
> Where did you get that from?
gcc documentation. I just looked in Stroustrups C++ book, but couldnt find 
it, so it might be a gcc'ism, but I believe it makes sense.

< sorry for the horrible example ;-) >

> > On top of that, if you use delete on an array you cannot assume not to
> > have a memory leak.
>
> This OTOH is true.  new[] and new might use completely different mem
> areas and structures, so "delete[] x" for a "x=new T" might fail.

The above is one of reasons why they need completly different structures in 
the first place.

`allan
[prev in list] [next in list] [prev in thread] [next in thread] 

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