& Lt; cerrno & gt;, cerrno

Source: Internet
Author: User

<Cerrno>, cerrno

File Header Name:

<Cerrno> (errno. h)

File Header description:

The following macros are defined in the file.

Errno
Last error code

 

  

Add at least three other macro constants:EDOM,ERANGEAndEILSEQ

Macro definition Required header file

Errno<Cerrno>

This macro definition can be extended to the left value of a modifiable INTEGER (LvalueOf typeint); So it can be read and modified by the program; errno is set to 0 when the program is started, and any function in the C standard library can be changed to other values not 0, it is generally used to mark errors of a specific category (the general library function will not be modified once set)A program can also modify this value. If this variable is used for the error check after the library function call, it should be pre-set by the program before the call (because anyThis value is changed when the library function is called in advance)At least the following non-zero macro variables are declared in the same header file that declares errno:

Macro name What does it mean when the errno value is set to this value?
EDOM Domain error: some mathematical functions are defined only for some actual values (certain real values). This is called a Domain. For example, the field of the function that calculates the square root is not negative. Therefore, when sqrt passes in a negative number and is called as a parameter, the sqrt function sets errno to EDOM;
ERANGE Range Error: the value of a range variable is limited. For example, a pow in a mathematical function can be easily computed by floating-point data beyond the range, or the number of digits in a string in the function strtodd may exceed the range that can be expressed by this value. In these cases, errno is set to ERANGE;
EILSEQ Invalid sequence: A Multi-Byte Character Sequence may have a limited number of valid sequences. When a multi-byte set is converted by the mbrtowc function for example, errno is set to EILSEQ in case of an invalid sequence;

The functions in these standard libraries may set errno to any value (not just a few values listed above). Specific functions may define additional names in this header file;The basic set of values set defined in the c ++ 11 extension must be declared in this header file, including many names that can also be used in the POSIX environment, the total number of errno values has increased to 78, and this number is growing. To view the complete list, see errc.The relationship between these special error messages and errno values can be obtained by using the strerror function or directly using the perror function to print the output;In C ++, errno is usually declared as a macro, but in C it is possibleImplement external links as an int object;

 

This library supports multithreading. Each thread has its own region's errno value. This is11 library compatibility requirements.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.