exception handling is the process of responding to the occurrence, during computation, of exceptions â anomalous or exceptional conditions requiring special processing â often changing the normal flow of program execution. it is provided by specialized programming language constructs or computer hardware mechanisms. in general, an exception is handled (resolved) by saving the current state of execution in a predefined place and switching the execution to a specific subroutine known as an exception handler. if exceptions are continuable, the handler may later resume the execution at the original location using the saved information. for example, a floating point divide by zero exception will typically, by default, allow the program to be resumed, while an out of memory condition might not be resolvable transparently. alternative approaches to exception handling in software are error checking, which maintains normal program flow with later explicit checks for contingencies reported using special return values or some auxiliary global variable such as c's  or floating point status flags; or input validation to preemptively filter exceptional cases. == exception handling in hardware == hardware exception mechanisms are processed by the cpu. it is intended to support error detection and redirects the program flow to error handling service routines. the state before the exception is saved on the stack. === hardware exception handling/traps: ieee 754 floating point === exception handling in the ieee 754 floating point hardware standard refers in general to exceptional conditions and defines an exception as "an event that occurs when an operation on some particular operands has no outcome suitable for every reasonable application. that operation might signal one or more exceptions by invoking the default or, if explicitly requested, a language-defined alternate handling." by default, an ieee 754 exception is resumable and is handled by substituting a predefined value for different exceptions, e.g. infinity for a divide by zero exception, and providing status flags for later checking of whether the exception occurred (see c99 programming language for a typical example of handling of ieee 754 exceptions). an exception-handling style enabled by the use of status flags involves: first computing an expression using a fast, direct implementation; chec
Control_flow Software_anomalies