Saturday, 16 December 2017
This is the last session in 2017 year. This session talks about exception handling and event handling.
In a language without exception handling:When an exception occurs, control goes to the operating system, where a message is displayed and the program is terminated.
In a language with exception handling:
Programs are allowed to trap some exceptions, thereby providing the possibility of fixing the problem and continuing.
Exception Handling Alternatives:
–Send an auxiliary parameter or use the return value to indicate the return status of a subprogram.
–Pass a label parameter to all subprograms (error return is to the passed label).
–Pass an exception handling subprogram to all subprograms.
–Send an auxiliary parameter or use the return value to indicate the return status of a subprogram.
–Pass a label parameter to all subprograms (error return is to the passed label).
–Pass an exception handling subprogram to all subprograms.
Advantages of built-in Exception Handling :
•Error detection code is tedious to write and it clutters the program.•Exception handling encourages programmers to consider many different possible errors.
•Exception propagation allows a high level of reuse of exception handling code.
Exceptions are all raised explicitly by the statement:
throw [expression];
throw [expression];
That's all for this session.
No comments:
Post a Comment