__cxa_demangle clarification

Mark Mitchell mark at codesourcery.com
Fri Mar 22 19:15:08 UTC 2002


A library implementor contacted me to indicate that he found this
description of __cxa_demangle's behavior to be unclear:

    If buf is not a null pointer, it must have been allocated with
    malloc. If the array turns out to be too small, __cxa_demangle may use
    realloc to increase its size. The new size will be stored in *n.

The problem is the use of the word "may" with respect to realloc.

I suggest that we change the wording to:

    If the array is too small, __cxa_demangle must either
    a) call "free" to deallocate the buffer provided and allocate a
       new buffer with "malloc",
    or b) call "realloc" to increase the size of the buffer.

If there are no objections, I'll make this change next week.

--
Mark Mitchell                   mark at codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com




More information about the cxx-abi-dev mailing list