Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: A chained e...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 8 Topic 9566 of 9823
Post > Topic >>

Re: A chained exception (base) class for C++

by Greg Herlihy <greghe@[EMAIL PROTECTED] > Apr 30, 2008 at 10:19 PM

On Apr 30, 4:05 pm, Erik Wikström <Erik-wikst...@[EMAIL PROTECTED]
> wrote:
> On 2008-04-30 18:43, Martin T. wrote:
>> --CODE--
> > [**** Usage would then roughly be like this ***]
> > using namespace std;
> > using namespace my_project_ns;
>
> > void f3e() {
> >    throw std::runtime_error("Any std::exception will do ...");
> > }
>
> > void f2e() {
> >    try {
> >            f3e();
> >    }
> >    catch(std_exc_catch_t e) {
> >            throw chained_exception("My exc", &e);
>
> 1. Did you not want to catch by const reference?

The exception "e" is being caught by const reference. See the typedef
for "std_exc_catch_t":

      typedef const std::exception&     std_exc_catch_t;

> 2. Will not e be destructed when you throw an exception leaving with a
>     dangling pointer in the chained_exception instance?

No.

Greg


-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 8 Posts in Topic:
A chained exception (base) class for C++
"Martin T." <  2008-04-30 10:43:22 
Re: A chained exception (base) class for C++
=?UTF-8?B?RXJpayBXaWtzdHL  2008-04-30 17:05:07 
Re: A chained exception (base) class for C++
Greg Herlihy <greghe@[  2008-04-30 22:19:30 
Re: A chained exception (base) class for C++
Martin T <0xCDCDCDCD@[  2008-05-01 13:14:31 
Re: A chained exception (base) class for C++
Eugene Gershnik <gersh  2008-05-02 04:43:58 
Re: A chained exception (base) class for C++
nickf3 <nickf3@[EMAIL   2008-05-02 04:44:00 
Re: A chained exception (base) class for C++
Martin T <0xCDCDCDCD@[  2008-05-02 12:48:14 
Re: A chained exception (base) class for C++
Martin T <0xCDCDCDCD@[  2008-05-02 12:47:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 1:40:29 CDT 2008.