Re: exception - twice handling
"Bharath" <bharath.donnipad@gmail.com>
I was trying to understand the below program. The output is given
below. I couldn't understand why "catch" is being handled in "main"
even though only once "throw exce();" is executed.
Sta() try
{
throw exce();
}
catch (...)
{
cout<<"Hello !!!!!\n";
}
Here you used a thing called 'function try block'. It is not like a simple
try block, that continues with the next line, finishing the exception.
(Unless you abort) FTR is always left throwing exception: you throw your own
explicitly, if you don't at the bottom you'll get an implicit throw;
(passing on the original one).
In your code that makes its way to then next catch block.
Note, that FTR is mainly used for one purpose only: to catch exception
thrown in the ctor member-initializer list.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]