operator new/delete forwarding
Martin Sebor
sebor@roguewave.com
Wed Jul 26 00:16:00 GMT 2006
Howard Hinnant wrote:
> On Jul 20, 2006, at 9:07 PM, Martin Sebor wrote:
>
>>> I think the standard allows either implementation. Imho the one I
>>> outlined is higher quality. I brought this issue up a long time
>>> ago with the LWG:
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#206
>>
>>
>> Hmm, but the Rationale for closing this issue as NAD was that [the
>> possibility that the operators would become unlinked] was by design.
>> Doesn't that mean that it's a deliberate feature for users to be
>> able to replace one without causing the other to be replaced as
>> well?
>
>
> I would call it a deliberate implementation degree of freedom, rather
> than a behavior that the client can rely on. The standard text doesn't
> mandate forwarding, nor forbid it.
But why would implementations be given this latitude when there's
virtually no difference (from an implementer's standpoint) between
one and the other, and when the only likely effect is the lack of
portability (albeit in corner cases)? It seems to me that if that
were the case everyone would lose. Implementers would be left
wondering which of two apparently equivalent techniques to go with,
and users (of the standard) couldn't rely on one type of behavior
or the other and would have to be prepared to handle both.
> Thus the client can not count on it
> existing or not existing, despite the fact that it is very visible. So
> as implementors, our job becomes to decide which technique is most
> valuable to the customer and go with that. If at some future date all
> vendors come to the same conclusion, the committee might standardize
> existing practice (if prodded into it).
My preferred course of action would be to reopen your issue and
get a confirmation/consensus on what the intent is before changing
gcc. None of the compilers I tried (gcc, HP aCC, IBM XLC++, and Sun
C++) implements your proposed behavior, as reasonable as it sounds,
so changing gcc would introduce an incompatibility not only with
older versions of itself but also with most other compilers as
well.
Martin
PS I just tried MSVC 8. It behaves the way you propose. It would
be interesting to find out if that's by design. The test program
I used is attached.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t.cpp
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20060726/cfae2406/attachment.ksh>
More information about the Libstdc++
mailing list