Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Try / catch
Try / catch [message #12418] |
Mon, 29 October 2007 10:56 |
pippo
Messages: 17 Registered: October 2007 Location: Italy
|
Promising Member |
|
|
Hello guru!
I have a question: try/catch handles only throw command or all exceptions?
I write this code:
int main()
{
printf("start\n");
try
{
int a = 0;
int b = 0 / a;
}
catch(...)
{
printf("error\n");
}
printf("end\n");
return(0);
}
Then, my program crash at line with "b=0/a".
With Ubuntu and U++ (debug mode and release mode)
and also with Windows Xp and Microsoft Visual Studio!!!
(Visual studio show a pop-up, to inform about exception).
WHY???
But, if I insert a "throw", then it jump correctly to catch(...).
I must verify all possible errors and insert my "throw"??? I don't belive!!!
Maybe I must active some flag?
10aa3a8774daeb994a88cc07572e2b6c
|
|
|
Goto Forum:
Current Time: Fri Mar 29 01:17:42 CET 2024
Total time taken to generate the page: 0.01575 seconds
|