Lecture17

Lecture17 - immediately without a return value. Control is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS11600: Introduction to Computer Programming (C++) Lecture 17 Svetlozar Nestorov University of Chicago 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 2 Outline ± Error handling mechanisms ± Exceptions ± try, throw, catch ± Exception objects 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 3 Error Handling ± What to do when an error (not a bug?) occurs. • Terminate program. • Return error code. • Return legal value, set global error code. • Call error handling function. • Throw an exception. 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 4 Exceptions ± An exception causes the function to return
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: immediately without a return value. Control is transferred to the first appropriate catch statement. Exceptions cannot be ignored! 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 5 Exception Structure try { throw exception; } catch ( signature ) { } May occur in a function call. May have multiple catch statements. 2/26/2003 Svetlozar Nestorov, CS 116: Intro to Programming II 6 Exception Objects Often, an exception is a string (char *). In general, any object can be an exception. Catch exception objects by reference....
View Full Document

This note was uploaded on 10/10/2009 for the course CS 11600 taught by Professor Svetlozarnestorov during the Winter '03 term at UChicago.

Ask a homework question - tutors are online