14-Exception%20Handling - 14 Exception Handling 14.1 Intro...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 313 - Fundamentals of Programming Languages 1 14. Exception Handling 14.1 Intro to Exception 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 ± Many languages allow programs to trap input / output errors (including EOF) ± An exception is any unusual event, either erroneous or not, detectable by either hardware or software, that may require special processing ± The special processing that may be required after detection of an exception is called exception handling ± The exception handling code unit is called an exception handler
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS 313 - Fundamentals of Programming Languages 2 14.1 Intro to Exception Handling (continued) ± An exception is raised when its associated event occurs ± A language that does not have exception handling capabilities can still define, detect, raise, and handle exceptions ± 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 ± Advantages of Built-in Exception Handling: ` Error detection code is tedious to write and it clutters the program ` Exception propagation allows a high level of reuse of exception handling code 14.1 Intro to Exception Handling (continued) ± Design Issues for Exception Handling: ` How and where are exception handlers specified and what is their scope? ` How is an exception occurrence bound to an exception handler? ` Where does execution continue, if at all, after an exception handler
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/15/2010 for the course ICS ics103 taught by Professor Alvi during the Spring '07 term at King Fahd University of Petroleum & Minerals.

Page1 / 7

14-Exception%20Handling - 14 Exception Handling 14.1 Intro...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online