answersLogoWhite

0

What is exception handling in C plus plus?

Updated: 8/19/2019
User Avatar

Wiki User

10y ago

Best Answer

Exception handling is the means by which exceptions -- anomalous events -- are resolved without causing a runtime error.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is exception handling in C plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which compiler is used for writing c plus plus exception handling programs?

C++ compiler, obviously, a C compiler won't do.


What is difference between exception handling in C and Java?

Easy: there is no exception-handling in C.


What are the Merits and demerits of exception handling in c plus plus?

Are mala cha pahije disadvantages.. ani tumhi mala vichartat.. ask to scientist....


How exception handling differs in C plus plus and Java?

Exception handling is largely the same for both. The only real difference is that C++ has no 'finally' clause which always executes whether an exception occurs or not. Another difference is that Java throws exceptions and errors, but errors cannot be handled since programs cannot handle errors -- such as the JVM out of memory error.


What is mapping exception in c plus plus?

There is no such exception in C++. It's probably a 3rd party or user-defined exception. Examine the call-stack to determine where the exception was caught -- that should help you determine where the exception was thrown.


What file pointers are available to support file handling in c plus plus?

For file handling, use the input/output file stream objects, ifstream and ofstream, declared in the <fstream> header of the C++ standard library. Do not use C-style pointers unless you absolutely have to. The problem with "raw" resource pointers is that the resources are not automatically released when the pointers fall from scope. This has implications for exception handling strategies and exceptions are anything but exceptional, particularly where file handling is concerned. When an exception is thrown, every resource consumed between the exception handler and the exception itself must be released. The exception handler is ideally placed in a calling function that is best able to deal with the exception, thus the handler may not have access to the resources that were consumed up to the point the exception occurred. This means that every callee that consumes a resource must include its own localised exception handler which simply releases the resource and re-throws the exception. With resource handles (also known as smart pointers) we do not have this problem because resources are automatically released when the handle falls from scope. Thus our exception handling strategy becomes much more localised and our code becomes that much easier to maintain. And we get all this at no additional cost. Pointers may well give programmers a high-degree of control over resources, but that control has a cost in terms of maintainability and, in some cases, may actually result in reduced performance due to increased code size. Pointers certainly have their uses in C++, but resource management is not one of them. Always use resource handles unless you have good reason not to. In short, C-style resource pointers should only be used in C code, never in C++ code.


What is the exact difference between interrupt handling and exception handling?

interrupt handling is the process of handling a break or interrupt called by a program where as exception handling is for handling some exceptional conditions that'll occur when a program is running


When is exception handling necessary for stream handling?

Exception handling is necessary for string handling as there might be some unexpected situation during string handling which may lead to program crash or abrupt termination


Can exception handling resolve the abnormal flow of a program?

An exception is abnormal program flow, so handling the exception is the very definition of resolving the abnormality.


Why you uses exception handling because you can handle exception using if Else statement?

We use exception handling so that the program can gracefully handle any situation that may be unexpected. We use try-catch for exception handling. if-else is a conditional logic checking mechanism


When should we use exception handling in java?

Exception handling should be used in Java in all cases where you as a programmer suspect that your code might throw some exceptions or create errors that might look ugly when a user is using the application. In such cases you use exception handling to catch and handle the exception and exit gracefully. You use the try - catch block in Java for exception handling.


What is file handling in c and c plus plus or objective c?

File handling is simply the process of opening, reading, writing and closing files. Files are simply streams for input and output, or the "serialisation" of objects. In other words, reading and writing data to and from disk storage.