Subject: Re: `sys_errlist' in `stdio.h'
To: None <current-users@NetBSD.ORG>
From: Henry G. Juengst, ISKP, Bonn <juengst@viskpc.iskp.uni-bonn.de>
List: current-users
Date: 01/11/1996 18:38:03
> Hi,
> 
>     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'.  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.  This argument suggests that the
> `const' keywords should be dropped from this declaration.

No, please NOT. Delete the private declarations of system identifiers in
any application and send the author of such a poor designed stuff a short
note that he/she could make the declaration in an extra header file using
"#ifdef" for a specific include if a specific system does not know them.
Example:

#ifdef moonos  /* promise someone the moon */
#  include "xxx_moonos.h"  /* Extra declarations for a moony OS */
#endif

A nice example why these private declarations are bad (or mad:-) 
is "lseek". Some guys define it with an "int" for the offset.

I am happy that NetBSD has these declarations, because they help us to
find bugs in programs.

> 
> - alan

Henry