[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sys_errlist (Re: gcc (Re: porting?))
On Tue, 10 Feb 1998, Yves Pelletier wrote:
> In function strerror(), sys_errlist is declared:
>
> #ifndef __MBASE__
> extern char const *const sys_errlist[];
> #else
> extern char const *sys_errlist[];
> #endif
Any reason why this has to be done because the variable is declared
inside strerror.c?
The best sould be if I'm asked to just declare it
char const *const sys_errlist[];
everywhere. The problem is that if it is used in baserel program it has
to have a right declaration. If it is declared diffrently or used without
declaration (?) linker fives a few nice errors. Any ideas anyone? Is the
array really needed to be global or could it just be static inside
strerror.c? The point of having both strerror() and the array is not
clear for me.
The reason it's declared globally is because it gets used by external code.
You might consider programs that reference sys_errlist as poorly behaved,
but there are a lot of them out there.
-- Howard