11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

expert systems 187On-line help <strong>and</strong> error messages can explain to users why aparticular input is invalid.)However, data validation can ensure only that data fallswithin the generally acceptable parameters. Some particularcombination or context <strong>of</strong> data might still be erroneous,<strong>and</strong> calculations performed within the program can alsoproduce errors. Some examples include a divisor becomingzero (not allowable mathematically) or a number overflowingor underflowing (becoming too large or too small forregister or memory space allotted for it).Error communication is generally h<strong>and</strong>led by a set <strong>of</strong>error codes (special numeric values) returned to the mainprogram by the function used to perform the calculation.In addition, errors that arise in file processing (such as “filenot found”) also return error codes. For example, supposethere is a division function in C++double Quotient(double dividend, doubledivisor) throw(ZERODIV){if (0.0 == divisor)throw ZERODIV();return dividend / divisor;}In C++ “throw” means to post an error that can be“caught” by the appropriate error-h<strong>and</strong>ling routine. Thus,the corresponding “catch” code might have:catch( ZERODIV ){cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!