reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Exception Handling - C++ [1/2]

Type:
Exception Handling - C++
Level: Expert reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia 
Exception Handling - C++
Date: 2006-Dec-12
Exception Handling - C++
Visited: 6253 times
Exception Handling - C++
Rating: Exception Handling - C++
Exception Handling - C++
Author: Alex Plumpton
Exception handling allows you to manage run-time errors in an orderly fashion. In the 'C' program, every call to the function must be examined by the program. If else statement should surround each function call, and statements must be inserted to handle errors. The source code becomes large and difficult to read. Also some function cannot return an Errorvalue.

Example
if(somefunc() == ERROR_RETURN_VALUE)
//handle the error or call error-handler function
else
//proceed normally
if(another func()==NULL)
//handle the error or call error handler function
else
//proceed normally
if(thirdfunc()==0)
//handle the error or call-handler function
else
//proceed normally

The three keywords throw, try and catch are used to handle exceptions. Function returning using the exception handling mechanism is referred to as throwing an exception. The keyword throw is used to throw an exception. Try keyword surrounds a block of statements which may generate exception. Catch block catches the exception thrown by throw and handles them appropriately. The general forms of try and catch are shown above.

Example
try
{
// try block
}
catch (type 1 arg){
// catch block
}
catch (type2 arg){
// catch block
}
catch (type3 arg){
// catch block 
}
reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia - Exception Handling - C++ [1/2] - reference, tutorial, tutorials, help, example, photoshop, html, php, mysql, 3d software, internet, graphics, programming, multimedia

Need a specific tutorial? Do not hesitate and submit a request!
Keywords: remote desktop port  function overloading c++  3ds max glass material  select query in PHP  exception handling in c++  PDF page rearrange  multlevel inheritance  my windows check  how to use virtualdub  barcode in coreldraw  how to restore my desktop on windows xp  configure ccproxy  trillian webcam  rename multiple files  funtions of c++  secure mysql c++ remote server  checking .net versions on windows xp  php infofile  mput with parameters  default password for plesk