This is my code :
#include<iostream>
#include<boost/shared_ptr.hpp>
using namespace std;
void func()
{
cout<<" func # "<<endl;
throw;
}
int main()
{
try
{
int x = -1;
cout<<" point 1 "<<endl;
func();
cout<<" point 2 "<<endl;
}
catch (exception& e)
{
cout<<" exception caught "<<endl;
//throw;
}
cout<<" point 3 "<<endl;
return 0;
}
Now, it's giving this result
point 1
func #
terminate called after throwing an instance of in
Abort
But I was expecting this:
point 1
func #
exception caught
What am I missing?
Why is terminate being called like this?
And also, what if I also throw from catch block?