Problems with __cxa_demangle and the verbose terminate handler
Mark Mitchell
mark@codesourcery.com
Sun Feb 22 19:01:00 GMT 2004
Gabriel Dos Reis wrote:
>When called from "C" land, those containers should probably be
>instantiated with an allocator that either calls malloc() or use the
>nothrow form of new. Useing "new" in itself is not the problem, it
>not is calling the nothrow-form of new that is problematic.
>
>
I considered and rejected the use of a special allocator.
If std::vector tries to allocate dynamic memory using an allocator that
does not use throw an exception (but instead returns NULL), what is
std::vector going to do?
I believe std::vector it will then either crash or throw an exception,
depending on the implementation.
(In fact, I do not believe that [lib.allocator.requirements] allows an
allocator's "allocate" function to return NULL.)
If the new demangler called "operator new" directly, then it could
indeed notice the return value being NULL and take appropriate action.
But, the calls to "operator now" are buried in std::vector and
std::string. I do not believe the use of those classes is compatible
with the requirement that no exceptions be thrown, even if subsequently
caught.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com
More information about the Libstdc++
mailing list