Content deleted Content added
m see talk |
minor: sp. |
||
Line 3:
Error codes are often process global variables, such as ''errno'' in C. A return code from a function will indicate an error condition (such as -1 bytes read from a file) and the programmer can then check the value of ''errno'' against a list of possible errors to determine why the function call failed.
Error codes are slowly disappearing from the programmer's environment as modern [[object oriented]] [[computer languages]] replace them with [[exceptions]]. Exceptions have the advantage of being handled with explict blocks of code, separate from the rest of the code. While it is considered poor practice, programmers often fail to check return values for error conditions, and this can cause undesirable effects as ignored error codes cause additional problems later in the program. Exceptions are implemented in such a way as to separate the error handling code from the rest of the code. Separating the error handling code makes programs easier to write, since one block of error handling code can service errors from any number of function calls. Exception handling also makes the code more readable, since
[[category:programming]]
|