strerror description strings

c, linux

Solution

They're defined somewhere in the C library, traditionally in a global array of `char*` called `sys_errlist` of length `sys_nerr`, at least on Unix systems.

Because legacy programs, written before `strerror` was standardized, may access this array directly, it's still available even on modern GNU/Linux and Mac OS X for backward compatibility (though you really shouldn't access it except through `perror` or `strerror`).

E.g, here's the Mac OS X 10.8.2 definition of `sys_errlist`.

Problem

The C function `strerror` returns an error description string, as detailed here. Example string ``` No such file or directory ``` The question is where are these strings defined? I looked through my header files and did not see anything.

Original source