lecture37-may1 - Lecture 37 Announcements Assignment 7 Due...

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

View Full Document Right Arrow Icon
Lecture 37 Announcements • Assignment 7 • Sample exam 3 on BB – Exam 3 on Friday, May 8 in class – No final • Topics of the day Exceptions Exception Handling in C++ What are Exceptions? Exception - a run time error in your program Exception handling - using the features of the language to manage run time errors in an orderly fashion Exception object - is created when the error occurs and contains information about it Why Use Exceptions (1) • Separate normal from abnormal processing 9 For example, what to do if a function’s precondition is violated 9 Normal processing often quite straightforward 9 Abnormal often quite tangled • Causes nesting • Obscures normal processing ± We want to separate Error Handling Code from Regular Code 9 So that frequent and repetitive testing of return values, and propagation of error return values, is not required. 9 Using exceptions may be more efficient because the normal execution path does not need to test for error conditions. 9 We can group Error Types and Error Differentiation Examples • Nested tangle if (condition1) then do something1 if (condition 2) then do something2 if (condition3) then do something3 else exception3 else exception2 else exception1 • With exceptions Do something1 Do something2 Do something3 Handle Exceptions: ex1: exception1 ex2: exception2 ex3: exception3 Why Use Exceptions (2) • Necessary for reliable, fault tolerant, robust software systems – Often 75%+ code dedicated to reliability – 20% of interface errors are errors in handling exceptions ± We want to manage run time errors in an orderly fashion so as to create fault tolerant software systems 1. If an exception is not caught, the program terminates. 2. Advanced error handling can be done that allows for
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas.

Page1 / 3

lecture37-may1 - Lecture 37 Announcements Assignment 7 Due...

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

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