Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Try / catch
Re: Try / catch [message #12426 is a reply to message #12418] Tue, 30 October 2007 09:37 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
pippo wrote on Mon, 29 October 2007 05:56

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?



C++ and system exception are not the same thing.

Mirek
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Previous Topic: File List with FtpClient
Next Topic: Template problem
Goto Forum:
  


Current Time: Sun Apr 28 13:13:48 CEST 2024

Total time taken to generate the page: 0.03141 seconds