<Cerrno>, cerrno
File Header Name:
<Cerrno> (errno. h)
File Header description:
The following macros are defined in the file.
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.