<errno.h> defines several macros, all relating to the reporting
of error conditions.
The macros are:
EDOM EILSEQ ERANGE
which expand to integer constant expressions with type
positive values, and which are suitable for use in
errno which expands to a modifiable lvalue 1 that has
int, the value of which is set to a positive error number by several
library functions. It is unspecified whether
errno is a macro or an
identifier declared with external linkage. If a macro definition is
suppressed in order to access an actual object, or a program defines an
identifier with the name
errno, the behavior is undefined.
The value of
errno is zero at program startup, but is never set to zero by
any library function. 2 The value of
errno may be set to nonzero by a
library function call whether or not there is an error, provided the use of
errno is not documented in the description of the function in this
Additional macro definitions, beginning with
E and a digit or
E and an
uppercase letter, may also be specified by the implementation.
The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue resulting from a function call (for example,
Thus, a program that uses
errnofor error checking should set it to zero before a library function call, then inspect it before a subsequent library function call. Of course, a library function can save the value of
errnoon entry and then set it to zero, as long as the original value is restored if
errno’s value is still zero just before the return.