array new-expressions: proposal

Daveed Vandevoorde daveed at edg.com
Mon Jan 24 17:19:55 UTC 2000


Martin von Loewis wrote:
> 
> > > PROPOSAL A.
> > >
> > > No version of operator new[] is a special case.
> [...]
> > 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.
> 
> Why not? Under the proposal, it would have exactly the effect of
> "specifying the 'this' pointer to a constructor". Of course, when you
> create an array, you invoke more than one constructor, so you see more
> than one 'this' pointer.

My understanding is that the new expression would first store the
number of elements to be destructed.  That means that besides just
specifying a this pointer to the repeated ctor calls, we also clobber
another location in the buffer.  That prevents me to overconstruct
subarrays and the like.

Or do I misunderstand?

	Daveed




More information about the cxx-abi-dev mailing list