replacing new, getting sane allocator/iostreams behavior

Benjamin Kosnik bkoz@redhat.com
Tue Jul 3 18:03:00 GMT 2001


Carlo.

First of all, I suggest you filing a bug in GNATS about this.

> #include <iostream>
> 
> void* operator new(size_t size)
> {
>   static std::ios_base::Init dummy;
>   std::cout << "Calling operator new\n";
>   return malloc(size);
> }
> 
> int main(void)
> {
>   return 0;
> }

Your patch won't work: it disables the sync_with_stdio functionality, for 
starters. Also, with changes to the allocator class and other bits, I'm 
not quite sure this is possible. 

-benjamin



More information about the Libstdc++ mailing list