|
| About | Home | Disclaimer | Privacy | Contact | |
|||
Visual C++ .Net Programming Tutorials: C++ .NET Exception Handling |
|||
Read me first buddies |
|||
|
|
Exceptions are an error-handling mechanism employed extensively in C++ and several other modern programming languages. Exceptions provide an alternative error-handling mechanism, which gives you three main advantages over traditional return value error handling:
1. Exceptions can’t be ignored. If an exception isn’t handled at some point, the program will terminate, which makes exceptions suitable for handling critical errors. |
|
HomeC++ .NET Exception Handling 1C++ .NET Exception Handling 2C++ .NET Exception Handling 3C++ .NET Exception Handling 4C++ .NET Exception Handling 5C++ .NET Exception Handling 6C++ .NET Exception Handling 7----------------Tenouk C and C++ Programming Tutorial |
|
2. Exceptions don’t have to be handled at the point where the exception occurs. An error can occur at many levels of a function calls deep in a program, and there might not be a way to fix the problem at the point where the error occurs. Exceptions let you handle the error anywhere up the call stack. 3. Exceptions provide a useful way to signal errors where a return value can’t be used. There are two particular places in C++ where return values can’t be used: constructors don’t use them, and overloaded operators can’t have their return value overloaded to use for error and status information. Exceptions are particularly useful in these situations because they let you sidestep the normal return-value mechanism. The handler for an exception can occur in the routine in which the exception was thrown. It can also occur in any routine above it in the call stack, and, at run time, each routine in the call stack is checked to see if it implements a suitable handler. If nothing suitable has been found by the time the top of the stack has been reached, the program terminates. In .NET, they can be used across languages. Because exceptions are part of the underlying .NET Framework, it’s possible to throw an exception in C++ code and catch it in Microsoft Visual Basic .NET, something that isn’t possible outside the .NET environment. So, you fill find the DLL program example in this Tutorial created in VC++ .NET and the used by Visual Basic .NET... |
|||
|
| About | Home | Disclaimer | Privacy | Contact | |
|||
|
Best viewed using IE 6.0/FireFox 1.5.0 and above Webmaster contact: [contact[@]visualcplusdotnet.com] Copyright 2007 © Visualcplusdotnet. All rights reserved. |
|||
| Excellent hosting services provided by MochaHost - The Online Central | |||