Fwd: Re: deleting null pointer arrays (was: Re: extragear/network/ktorrent)

Dominik Haumann dhdev at gmx.de
Wed Jan 21 14:56:16 GMT 2009


On Friday 16 January 2009, Alexander Neundorf wrote:
> On Friday 16 January 2009, Adriaan de Groot wrote:
> > As one of the dudes using the Sun C compiler the most on KDE code (and
> > incidentally defining which versions are considered suitable for use),
> > I'll chime in here.
> >
> > On Friday 16 January 2009 01:49:25 Michael Pyne wrote:
> > > On Thursday 15 January 2009, Dominik Haumann wrote:
> > > > according to [1] this change is wrong:
> > > > >>         BitSet & BitSet::operator = (const BitSet & bs)
> > > > >>         {
> > > > >> -               if (data)
> > > > >> -                       delete [] data;
> > > > >> +               delete [] data
> > >
> > > The way delete [] works is that the size of the array is embedded
> > > somewhere in the array to be deleted (handled by the corresponding
> > > new[]).  delete[] uses this information to free the array
> > > appropriately.
> > >
> > > Apparently the "recent Solaris compiler" does not check for 0 before
> > > trying to find the hidden array length.
> >
> > Might be. I'd have to know more from the OP about what version exactly
> > that recent compiler is; Ceres (StudioExpress) is considered
> > experimental; Mars 124864-03 is slightly too old (but is what I'm using
> > on my own laptop) and -08 is approved.
>
> If you find out, I think it would be good if it was explicictely named on
> that wiki page.
>
> Alex

Yes, I also would like to make sure what's in our docs is correct ;) So if 
you have any news on this, please keep us informed.

Dominik




More information about the kde-core-devel mailing list