If the function func() throws an exception, but we don't call the func() from try clause (to at least swallow the exception), let alone use catch clause, would that possibly show some undefined behaviors later on?
Code:
int main()
{
...condition is setup for func() to throw an exception...
func();
...program goes on...
return 0;
}
I was reading a c++ reference book, and it was talking about a function storing exception information into a call stack after each of a try or catch clause. Did I get that right? Then from the function below if func2() throws an exception, does that get stored in func2's call stack, or func1's call stack.
So in general, I'm confused as to how and why call stack is used to keep the exception information and what consequences I have related to this if I don't swallow/catch the exception like the example shown above.
Code:
int func1()
{
...
try{
func2();
}
...
return 0;
}