| Re: A proposal to cancel overriding the DEFAULT operator new/delete |
|
 |
|
 |
|
 |
|
 |
Group: comp.lang.c++.moderated · Group Profile
Author: xushiweixushiwei Date: May 2, 2008 11:12
{ clc++m uses English. It would be nicer for other English-only-speaking
readers if the attribution line used English and the whole article used
an encoding such as US-ASCII, ISO-8859 or UTF-8 that more English-based
systems have support for, though none of these is a rejection reason.
-mod }
On 4月30日, 下午9时16分, Tony Delroy yahoo.co.uk> wrote:
> Why do you think existing code bothers to override the default
> operator new/delete? It's typically not just for the sake of it.
> Clearly it achieves some purpose: particular performance
> characteristics, instrumentation, validations, supports some
> functionality like persistence, who knows? You don't. I'm confident
> that the C++ standards committee wouldn't simply presume that it's not
> important to the application - in the face of the fact that the
> programmer thought is was important enough to code in the first place
> - and can be arbitrarily discarded, regardless of how you implore them.
Why overriding the DEFAULT operator new/delete is bad?
Allowing to override the DEFAULT operator new/delete means the DEFAULT
operator new/delete are special operators. When we have more than one
implementations of an operator, the compiler/linker will report a
redefining error. However, it allows there are two implementations of
the DEFAULT operator new/delete (one of them is implemented as
default). It sounds good. But, This gives a hint that there may have
many implementations of the DEFAULT operator new/delete. When this
happens, the compiler/linker doesn't know what should it do, and it
reports a defining error. The C++ programmers have to solve such
accidents, especially when they use 3rdparty codes ―― You know, there
are many libraries overriding the DEFAULT operator new/delete. But
unfortunately, they take a risk of conflict with each other.
|