int errno;

errno is treated as an writable l-value, but the implementation of how the l-value is read an written is hidden from the user.

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.

In this implementation, errno expands to a function call to __errno (MSP430, AVR, MAXQ) or __aeabi_errno_addr (ARM) that returns a pointer to a volatile int. This function can be implemented by the application to provide a thread-specific errno.