Hi,
Mine is a simple program of Try/Catch block. In try I generate exception by one of these(writing to invalid address/ divide by zero). I am catch for all exceptions (ellipse) and logging in catch block. I am using VS 2008 as my IDE.
In Debug mode it works fine. Catching the exception and graceful exit of program. But if I invoke program built in Release mode, exception is not handled crashing the program.
Any help would be appriciated.
Thanks
Mine is a simple program of Try/Catch block. In try I generate exception by one of these(writing to invalid address/ divide by zero). I am catch for all exceptions (ellipse) and logging in catch block. I am using VS 2008 as my IDE.
In Debug mode it works fine. Catching the exception and graceful exit of program. But if I invoke program built in Release mode, exception is not handled crashing the program.
Any help would be appriciated.
Code:
int _tmain(int argc, _TCHAR* argv[]) { try { printf("About to try\n"); int j,i=20; j=i/0; *(char *)j = 0000; printf("Try done\n"); } catch(...) { printf("Caught Exception\n"); } printf("Waiting to stop\n"); Sleep(5000); return 0; }
Comment