array new-expressions: proposal

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Jan 24 18:51:02 UTC 2000


> 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?

I was only talking about the (void*) variant, here.

> 
> 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&).

Did you mean ::operator new[](std::size_t, void*), here? That is the
one where special-casing is useful.

Regards,
Martin




More information about the cxx-abi-dev mailing list