请输入您要查询的百科知识:

 

词条 Return code
释义

  1. In systems software

  2. In networking software

  3. Error codes and exception handling

  4. See also

  5. External links

{{redirect-distinguish|Error code|Error-correcting code}}{{unreferenced|date=August 2012}}

In computer programming, a return code or an error code is an enumerated message that corresponds to the status of a specific software application. They are typically used to identify faults, such as those in faulty hardware, software, or incorrect user input.

In systems software

Exit status is the return code of computer programs running as processes, and is communicated through system calls.

In networking software

Network protocols typically support returning status codes. In the TCP/IP stack, it's a common feature of higher level protocols. For example:

  • List of HTTP status codes
  • List of FTP server return codes
  • Simple Mail Transfer Protocol#Protocol overview

Error codes and exception handling

Error codes are used in various methods of solving the semipredicate problem. They are generally similar to exception handling in programming languages that support it.

Error codes are slowly disappearing from the programmer's environment as modern object-oriented programming languages replace them with exceptions.{{editorializing|date=April 2017}}{{citation needed|date=April 2017}} Exceptions have the advantage of being handled with explicit blocks of code, separate from the rest of the code. While it is considered poor practice in methodologies that use error codes and return codes to indicate failure, programmers often neglect to check return values for error conditions. That negligence can cause undesirable effects, as ignored error conditions often cause more severe 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 from the normal logic makes programs easier to write and understand, since one block of error handling code can service errors from any number of function calls. Exception handling also makes the code more readable than implementations with error codes, since exception handling does not disrupt the flow of the code with frequent checks for error conditions.

See also

  • errno.h, a header file in C that defines macros for reporting errors
  • Abort (computing)
  • Aspect-oriented programming
  • Failure
  • Exit status
  • Static code analysis

External links

  • [https://web.archive.org/web/20110115230351/http://www.barricane.com/c-error-codes-include-errno Lists of Linux errno values, both numeric and symbolic]
  • Microsoft system error codes
  • Microsoft Device Manager error codes

1 : Software

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/10 10:16:53