Subject: Re: `sys_errlist' in `stdio.h'
To: None <current-users@NetBSD.ORG>
From: Alan Peakall <alan@parsys.co.uk>
List: current-users
Date: 01/12/1996 09:21:20
  Hi,

> > extern const char *const sys_errlist[];

> I have no problem with the declaration, as I believe that the const
> qualifiers provide significant benefit (more on this later).  But
> after surveying some of the other OS's we have at the office, it
> would seem that <errno.h> is a more appropriate place for it than
> <stdio.h>.

Moving the declaration to <errno.h> would address the original problem,
as ``old'' code should no more know about that header than about `const'.

> Well "new" code that has to access sys_errlst directly (like the
> implementation of strerror itself)

Are there other examples outside libraries ?  Surely casting away `const'
in the implementation of _library_ code is implicitly sanctioned in
ANSI-C by the specification of `strtol(3)'.  In detail

    extern	long	strtol(	const char  *,	/*  In      Str		*/
				char	    **,	/*      Out Endp	*/
				int	    );	/*  In	    Base	*/

where, in updating `*Endp', the implementation must cast away the `const'
on `Str'.

- alan