[Patch] libstdc++/14493

Paolo Carlini pcarlini@suse.de
Tue Jan 30 21:16:00 GMT 2007


Hi Howard,

> ABI concerns?  Say a client that derived from bad_alloc and 
> overloaded  what()?  Wouldn't his what() get corrupted (call the wrong 
> what())?   Other than that (and hope I'm wrong) I like this change.

thanks for asking, better be safe, this PR remained open so much time...

Anyway, are you considering a situation like compiling the following 
with a previous compiler:

#include <new>
#include <cstring>
#include <cassert>

struct my_bad_alloc
: std::bad_alloc
{
  virtual const char*
  what() const throw()
  { return "my_bad_alloc"; }
};

int main()
{
  my_bad_alloc mba;
  assert( !strcmp(mba.what(), "my_bad_alloc") );
}

and running it (linking it) vs the new .so? It runs fine.

Paolo.



More information about the Libstdc++ mailing list