Subject: Re: `sys_errlist' in `stdio.h'
To: Alan Peakall <>
From: J.T. Conklin <>
List: current-users
Date: 01/11/1996 12:11:21
> I would like to query the wisdom of having the declaration
> #if !defined(_POSIX_SOURCE) && !defined(_ANSI_SOURCE)
> .  .  .
> extern const char *const sys_errlist[];
> #endif
> in the header file `stdio.h'.  

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

> It seems to me that this presents no gain to ``new'' code because it
> should be using `strerror(3)' rather than `sys_errlist', while
> posing a gratuitous problem for ``old'' code which won't know about
> `const' and will thus get a compilation error when it declares
> `sys_errlist' for itself.

Well "new" code that has to access sys_errlst directly (like the
implementation of strerror itself) does benefit that the added const
qualifiers will catch programming errors that would result in the
error message text being modified.  In my opinion, a compile time
error is better than a run time core dump.