In the following code, at the first iteration I get an exception, and at the second one I get a segmentation fault with no error message printed. It seems the exception is not caught:
int i = 0;
while(i++ < 10)
{
try {
cout << "Iteration: " << i << endl;
// Code...
cout << "OK" << endl;
}
catch(...)
{
cerr << "Error message" << endl;
continue;
}
}
Output:
Iteration 1
Error message
Iteration 2
Segmentation fault
Is it normal, or there is something really wrong going on?
In case it should be relevant, in that code block I reset a MySQL connection, and the exception is generated when I check if the connection is closed.
Thank's.
Platform:
Linux - OpenSuse 11.4
C++ - GCC 4.5.1
Intel Xeon