Subject: Re: `sys_errlist' in `stdio.h'
To: None <current-users@NetBSD.ORG>
From: Robert Black <r.black@ic.ac.uk>
List: current-users
Date: 01/15/1996 12:23:43
On Jan 11,  5:04pm, Brad Salai wrote:
> Subject: Re:  `sys_errlist' in `stdio.h'
> >> 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 [stdio.h].  It seems to me that this [...poses] 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.
> >
> >Yes.
> >
> >> This argument suggests that the `const' keywords should be dropped
> >> from this declaration.
> >
> >Personally, I like it the way it is.  The compilation "error" is really
> >only a warning, and it is a good way to find old code that uses
> >sys_errlist[].  You can always ignore the warning if you don't want to
> >fix the code, after all.
> >
> Actually, for me, the way it is, generates fatal errors that require
> commenting out the offending declaration in the source, not just a warning.
> I am among the great unwashed, at least as far as programming is concerned,
> but would appreciate a solution that didn't require this kind of tinkering
> to get things to build.

One way might be to guard the declaration with a

#ifndef BROKEN_SYS_ERRLIST

This might be slightly more palettable when porting a million+ lines of badly
written code as you can probably get away with a single change to the make
system.

Cheers

Rob Black

--