> For my current implementation, I started from the opposite direction, > capturing only the official POSIX errnos from its documentation, then > conditionally compiling out ones that are not supported by a > particular operating system, like System V STREAMS for OpenBSD. This > of course requires more work, and more cond-expands for every > supported system that doesn't implement the full set. In some cases it's useful to detect specific features (#ifdef EINTR), in others it's better to detect entire operating systems (#ifdef __OpenBSD__). In this case, I'd argue for detecting individual errno values: * The set of errno values supported by any given OS is likely to change over the years. * POSIX guarantees that each of its errno values is a #define, and in seems to be a universal custom for non-POSIX errno values as well. Hence using #ifdef to detect the presence of an errno value should be fine. POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html> says: "The <errno.h> header shall define the following macros which shall expand to integer constant expressions with type int, distinct positive values (except as noted below), and which shall be suitable for use in #if preprocessing directives:" * The sets of non-POSIX errno values per OS are overlapping, so there would be duplication if each OS's set is listed separately. * A identifier being used for an errno value is unlikely to be defined for some other purpose by some OS. If it is, we can add an extra protective #ifdef to the groveler for that errno value. > In reference to > the strerr_r mess I came across someone who aptly described > conditional compilation as leaving skid marks in your code. [Insert pun about semantic drift]