tailieunhanh - Lecture Practical C++ programming - Chapter 22: Exceptions

With exceptions, the error handling interface is much easier. The C++ throw command creates an expection that's handled by the catch block. The nice thing only the functions that does the throw and the one that catches it need to worry about the exception. All the other functions on the call stack don't have to worry about problems and don't have to pass error codes up the call stack. | Chapter - 22 Exceptions Practical C Programming Copyright 2003 O Reilly and Associates Page1 Exceptions Exceptions are emergency procedures We ve already seen exceptions caused by divide by 0 or segmentation v iolation. The way our program h andled these exceptions is to die. We can generate our own exceptions and our own handling of them. Practical C Programming Copyright 2003 O Reilly and Associates Page2 Exception Description A description of a possible problem. A section of code in which the e xception may occur which is enclosed in a try statement. Something that causes an exception and triggers the emergency procedures through a throw statement. Exception handling code inside a catch block. Practical C Programming Copyright 2003 O Reilly and Associates .