This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH: operator delete[]
- To: gcc-patches at gcc dot gnu dot org, nathan at acm dot org
- Subject: Re: C++ PATCH: operator delete[]
- From: f981500 at FFZJ0LX0 dot bank dot dresdner dot net (James Kanze)
- Date: Wed, 2 Feb 2000 14:36:03 +0100
- Cc: f981500 at FFZJ0LX0 dot bank dot dresdner dot net, oliva at lsd dot ic dot unicamp dot br
Since I started this whole thing:
- I seem to remember the question about operator delete being called
with a null pointer having been raised in comp.std.c++ a long time
ago. And that the conclusion was that any replacement function
must do the right thing.
- I don't really understand this 'at minimum' business. The function
must do *exact* what the standard requires, and no more. Within the
limits of the as if rule -- logging all deletes is legal, for example,
since a conforming program cannot tell that they are being logged.
In this regard, my debugging operator new/operator delete would be
conforming as well. As long as the program doesn't do anything
involving undefined behavior, it functions exactly as a (very
inefficient) operator delete should. (You have to ask it to check
for memory leaks, and that involves invoking a function not defined
by the standard.)
As long as the system operator delete[] invokes operator delete to
actually free the memory, and doesn't modify any other accessible
program state, it is legal. The rest is just a quality of implementation
issue.
--
James Kanze