patch for ext/debug_allocator.h (second attempt)
Dhruv Matani
dhruvbird@gmx.net
Wed Feb 4 08:18:00 GMT 2004
On Wed, 2004-02-04 at 01:15, Benjamin Kosnik wrote:
> >This patch makes the debug_allocator<> compile now.
>
> testsuite/ext/allocators.cc seemed to work before, but I agree, something's fishy...
>
> > Earlier, the debug_allocator<> had code like this:
> >
> >size_type n;
> >pointer x;
> >*x = n;
> >
> >Which made no sense.
>
> Right.
>
> However, we're trying to stay away from static data members, and ugly
> casting. Try this.
The patch is fine except for the modification in the deallocate
function. You can not deref. a pointer and then static_cast<> it to an
integer. I changed that to a reinterpret_cast before deref. and delayed
the dref. to after the casting has been done. I've attached the patch
for the modified debug allocator against the current version in CVS.
Is another change log reqd?
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.20040204-debug_alloc
Type: text/x-patch
Size: 3042 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20040204/c46f3f7d/attachment.bin>
More information about the Libstdc++
mailing list