array new-expressions: proposal

John Wilkinson jfw at cthulhu.engr.sgi.com
Fri Jan 21 23:09:44 UTC 2000


Christophe de Dinechin wrote:
> 
> Daveed Vandevoorde wrote:
> >
> > Matt Austern wrote:
> > [...]
> > > PROPOSAL A.
> > >
> > > No version of operator new[] is a special case.
> > [...]
> > > PROPOSAL B.
> > >
> > > ::operator new[](size_t, void*) is a special case.  For that
> > > version of operator new[] only, n1 = n * sizeof(T).  We do not
> > > store the number of elements in such an array anywhere.
> >
> > There is a reason that placement new is called _placement_ new:
> > the intent was to allow the placement of objects and arrays at a
> > given address.  In effect, it's a way to specify a "this" pointer
> > to a constructor.
> >
> > So I think Proposal A is really not a good idea.
> >
> >         Daveed
> 
> I sent a message to the -libraries mailing list. Although I agree with the
> intent, there is also the question of how you expect people to delete[] it. If I
> were to vote today, I'd agree with Daveed (and disallow delete[] on the result),
> but I'm not sure enough though has been given to it.
> 
> Regards
> Christophe

Note that in earlier drafts of the Standard (up till Stockholm at
least), delete[] WAS forbidden on pointers obtained from placement
vector new.

-- 
John Wilkinson




More information about the cxx-abi-dev mailing list