|
#include "install_my_handler.h"
#include <iostream>
using std::cout;
using std::endl;
namespace
{
void install_my_exc_handler()
{
if(my_handler::install_my_handler())
cout<<"using my exception handler..."<<endl;
else
cout<<"failure in installing my handler"<<endl;
}
int g_i = 0;
class E
{
};
void foo()
{
try
{
cout<<"in foo()"<<endl;
if(0 == g_i)
throw E();
cout<<"exiting foo()"<<endl;
}
catch(E&)
{
cout<<"caught E exception"<<endl;
}
}
}
int main()
{
foo(); //use vc++ default exception handler.
install_my_exc_handler();
foo();
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.