errno groveler in C Lassi Kortela (27 Jun 2020 12:03 UTC)
Re: errno groveler in C John Cowan (27 Jun 2020 12:10 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 12:16 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 12:26 UTC)
SRFI directory layout Lassi Kortela (27 Jun 2020 12:40 UTC)
Re: SRFI directory layout hga@xxxxxx (27 Jun 2020 13:42 UTC)
Re: SRFI directory layout Arthur A. Gleckler (27 Jun 2020 20:07 UTC)
Re: SRFI directory layout John Cowan (27 Jun 2020 13:53 UTC)
Re: SRFI directory layout Arthur A. Gleckler (27 Jun 2020 20:01 UTC)
Re: errno groveler in C Arthur A. Gleckler (27 Jun 2020 16:35 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 12:21 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 12:34 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 13:51 UTC)
Re: errno groveler in C hga@xxxxxx (27 Jun 2020 14:24 UTC)
Re: errno groveler in C Lassi Kortela (27 Jun 2020 14:32 UTC)

Re: errno groveler in C Lassi Kortela 27 Jun 2020 12:34 UTC

> 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]