int status;
char *realname;
- // exception classes not in <stdexcept>, thrown by the implementation
- // instead of the user
- std::bad_exception e;
- realname = abi::__cxa_demangle(e.what(), 0, 0, &status);
- std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
-
// typeid
bar<empty,17> u;
const std::type_info &ti = typeid(u);
This prints
</p><pre class="screen">
<code class="computeroutput">
- St13bad_exception => std::bad_exception : 0
3barI5emptyLi17EE => bar<empty, 17> : 0
</code>
</pre><p>
The demangler interface is described in the source documentation
linked to above. It is actually written in C, so you don't need to
be writing C++ in order to demangle C++. (That also means we have to
- use crummy memory management facilities, so don't forget to free()
- the returned char array.)
+ use crummy memory management facilities, so don't forget to
+ <code class="code">free()</code> the returned char array.)
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ext_io.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extensions.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ext_concurrency.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 27. Input and Output </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 29. Concurrency</td></tr></table></div></body></html>
\ No newline at end of file
int status;
char *realname;
- // exception classes not in <stdexcept>, thrown by the implementation
- // instead of the user
- std::bad_exception e;
- realname = abi::__cxa_demangle(e.what(), 0, 0, &status);
- std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n';
- free(realname);
-
-
// typeid
bar<empty,17> u;
const std::type_info &ti = typeid(u);
<screen>
<computeroutput>
- St13bad_exception => std::bad_exception : 0
3barI5emptyLi17EE => bar<empty, 17> : 0
</computeroutput>
</screen>
The demangler interface is described in the source documentation
linked to above. It is actually written in C, so you don't need to
be writing C++ in order to demangle C++. (That also means we have to
- use crummy memory management facilities, so don't forget to free()
- the returned char array.)
+ use crummy memory management facilities, so don't forget to
+ <code>free()</code> the returned char array.)
</para>
</chapter>