by sachinmaza

Slides
7 slides

FAULT AVOIDANCE.ppt

Published Jun 25, 2013 in
Direct Link :

FAULT AVOIDANCE.ppt... Read more

Read less


Comments

comments powered by Disqus

Presentation Slides & Transcript

Presentation Slides & Transcript




FAULT AVOIDANCE


It deals with the prevention of fault occurrence by construction


Fault Tolerance
It deals with the method of providing services complying with the specification inspite of faults having occurred(or occuring) by redundancy

In C++ Exception Handling allows to build fault tolerant systems.

EXCEPTION HANDLING
An exception is a run-time error.
For example, an undetected division by zero or dereferencing of an invalid pointer will almost certainly terminate the program abruptly.
Exception handling consists of three things:
(i) the detecting of a runtime Error
(ii) raising an exception in response to the error
(ii) taking corrective action.
The latter is called recovery.

Exception handling constructs
The following ate three constructs for defining the blocks are as follows

1.try
2.throw
3.catch

Throw construct
The keyword throw is used to raise an exception when an error is generated in the computation.
The throw-expression intializes a temporary object of the type T used in throw.the syntax of throw construct is
throw T

Catch construct
It must be used immediately after the statements marked by the try keyword.
Each handler will only evaluate an exception that matches,or can be converted to the type specified in its argument list.
The syntax of the catch construct are as follows

catch(T)
{//actions for handling an exception}

try construct
This indicates that the program is prepared to test for exiestence of exceptions
If an exception occurs,the program flow is interrupted
syntax:

try
{//code raising exception or referring to a function
//raising exception
}
Catch(type_id1)
{
//actions for handling an exception.
}
Catch(type_idn)
{//action for handling an exception
}