Problems with __cxa_demangle and the verbose terminate handler
Mark Mitchell
mark@codesourcery.com
Mon Feb 23 08:20:00 GMT 2004
Matt Austern wrote:
> 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?
Return NULL, and set the status parameter to indicate memory allocation
failure, as required by the ABI.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
More information about the Libstdc++
mailing list