array new-expressions: proposal

Matt Austern austern at isolde.engr.sgi.com
Mon Jan 24 18:10:17 UTC 2000


On Jan 24,  7:05pm, Martin von Loewis wrote:
>
> It seems to me that not having the array size in a placement-new
> breaks the requirement that the corresponding delete expression will
> call all element's destructors (in reverse order). If that is a
> limitation of the ABI, that's fine with me.
>
> Regards,
> Martin
>-- End of excerpt from Martin von Loewis

Depends on what you mean by placement-new.  Do you mean
   char buf[100 * sizeof(T)];
   new(buf) T[100];,
or do you mean, more generally, any array new where you
provide extra arguments?

If you mean the latter, then we'd be saying that the pointer
we get from
   new(std::nothrow) T[100]
can't be deleted.  That, in my opinion, is not fine at all.
That's why I didn't propose it as an alternative.  I think
either we should say that we store the number of elements in
the array for all kinds of placement new, or else that we
should do it for everything but the special case
  ::operator new[](std::size_t, const std::nothrow_t&).


			--Matt




More information about the cxx-abi-dev mailing list