#define errno (*__errno())

errno macro expands to a function call to __errno that returns a pointer to an int. This function can be implemented by the application to provide a thread specific errno.

The value of errno is zero at program startup, but is never set to zero by any library function. The value of errno may be set to a nonzero value by a library function, and this effect is documented in each function that does so.


The ISO standard does not specify whether errno is a macro or an identifier declared with external linkage. Portable programs must not make assumptions about the implementation of errno.