<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-13 23:18 GMT+01:00 Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="">On Thu, Feb 13, 2014 at 3:57 PM, Nick Rudnick <span dir="ltr"><<a href="mailto:nick.rudnick@gmail.com" target="_blank">nick.rudnick@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-family:'courier new',monospace">std::set_unexpected (myUnexpected);</span><br>


</div><div><font face="courier new, monospace">try {</font></div><div><font face="courier new, monospace">  throw runtime_error("OOOPS..."); </font></div><div><font face="courier new, monospace">}</font></div><div>


<font face="courier new, monospace">catch (int) { std::cerr << "caught int\n"; }</font></div><div><font face="courier new, monospace">catch (...) { std::cerr << "caught some other exception type\n"; }</font></div>


<div><br></div><div>still is the problem that the STDERR message of <span style="font-family:'courier new',monospace">myUnexpected doesn't appear – is </span></div></div></blockquote><div><br></div></div><div>
You're catching all exceptions so there are no "unexpected" ones to invoke myUnexpected on.</div></div></div></div></blockquote><div><br></div><div>I experimented with commenting out the try/catch wrapping (I am afraid I did not make it clear; btw. the latter doesn't need <span style="font-family:'courier new',monospace">set_unexpected</span>). So my report refers to (only)</div>
<div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">std::set_unexpected (myUnexpected);</font></div>
</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="courier new, monospace">throw runtime_error("OOOPS...");</font></div></div></div></div></blockquote><div class="gmail_extra">
<div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>
<span style="font-family:'courier new',monospace">there anywhere code applying what you told about?</span></div>
</div></blockquote><div><br></div></div><div>I'm not sure what you're asking here. My suggestion was essentially to have something like the try/catch you wrote for testing above wrapped around whatever C++ code is throwing the exception, and invoke that try/catch via the FFI.</div>
</div></div></div></blockquote><div><br></div><div>Oh, I am reworking an FFI interface to C++, and thought it would be neat to give it a nice exception handling, too. As you appeared quite experienced and I consider this to be a practical issue occurring not too seldom, I hoped you might refer to some project, where C++ exception handling is realized.</div>
<div><br></div><div>Thanks, Nick</div><div><br></div><div><br></div><div><br></div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
</div><div class=""><div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div>

<div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</div></div></div>
</blockquote></div><br></div></div>