I was trying this piece of code to check whether the divide by zero exception is being caught:
int main(int argc, char* argv[])
{
try
{
//Divide by zero
int k = 0;
int j = 8/k;
}
catch (...)
{
std::cout<<"Caught exception\n";
}
return 0;
}
When I complied this using VC6, the catch handler was executed and the output was "Caught exception". However, when I compiled this using VS2008, the program crashed without executing the catch block. What could be the reason for the difference?