Problems with __cxa_demangle and the verbose terminate handler
Matt Austern
austern@apple.com
Mon Feb 23 06:11:00 GMT 2004
On Feb 22, 2004, at 11:01 AM, Mark Mitchell wrote:
> 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.
What would the appropriate action be?
--Matt
More information about the Libstdc++
mailing list