</p><pre class="programlisting">
#include <exception>
#include <iostream>
+#include <cstdlib>
#include <cxxabi.h>
struct empty { };
template <typename T, int N>
struct bar { };
-
int main()
{
int status;
bar<empty,17> u;
const std::type_info &ti = typeid(u);
- realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
+ realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &status);
std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
- return 0;
+ std::free(realname);
}
</pre><p>
This prints
<programlisting>
#include <exception>
#include <iostream>
+#include <cstdlib>
#include <cxxabi.h>
struct empty { };
template <typename T, int N>
struct bar { };
-
int main()
{
int status;
bar<empty,17> u;
const std::type_info &ti = typeid(u);
- realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
+ realname = abi::__cxa_demangle(ti.name(), NULL, NULL, &status);
std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
- return 0;
+ std::free(realname);
}
</programlisting>
<para>
* @param __output_buffer A region of memory, allocated with
* malloc, of @a *__length bytes, into which the demangled name is
* stored. If @a __output_buffer is not long enough, it is
- * expanded using realloc. @a __output_buffer may instead be NULL;
+ * expanded using realloc. @a __output_buffer may instead be null;
* in that case, the demangled name is placed in a region of memory
* allocated with malloc.
*
* -3: One of the arguments is invalid.
*
* @return A pointer to the start of the NUL-terminated demangled
- * name, or NULL if the demangling fails. The caller is
+ * name, or a null pointer if the demangling fails. The caller is
* responsible for deallocating this memory using @c free.
*
* The demangling is performed using the C++ ABI mangling rules,