This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Placement new[] weirdness
- To: Andrey Slepuhin <pooh at msu dot ru>
- Subject: Re: Placement new[] weirdness
- From: Branko Cibej <branko dot cibej at hermes dot si>
- Date: Thu, 15 Jul 1999 19:19:26 +0200
- CC: egcs at egcs dot cygnus dot com
- Organization: HERMES SoftLab
- References: <XFMail.990715184022.pooh@msu.ru>
Andrey Slepuhin wrote:
> Hi,
>
> We have the following in C++ draft, clause 5.3.4:
>
> 12[Example:
[...]
> This makes placement new[] operator totally useless.
>
> >From the other point, in C++ draft, clause 18.4.1.3:
>
> void* operator new[](std::size_t size, void* ptr) throw();
>
> Returns:
> ptr.
> Notes:
> Intentionally performs no other action.
>
> I.e. this contradicts to the previous description.
I wouldn't call that a contradiction. It's just that the placement
"overload"
of new[] behaves differently. Think template spacialisation.
> Can anybody check the final standard about this?
Yep, it's there, with the same wording.
> Indeed, I can imagine a correct implementation of placement new[]
> which has zero overhead for array length (though such implementation
> may have perfomance loss).
But you can't overload the new[] operator, you can only overload "operator
new[]", which is not the same thing. "new(p) t[]" is magic, it doesn't call
"operator new[]".
Brane
--
Branko Čibej <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 61) 186 53 49 fax: (+386 61) 186 52 70