[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sys_errlist (Re: gcc (Re: porting?))



On Thu, 12 Feb 1998, Yves Pelletier wrote:
> > char const *const sys_errlist[];
> Ok... that is what I will do, unless  someone tells me that 
> in non-mbaserel cases this definition causes unwanted effects in
> the assembly code.
> 
> Another thing: the way the return statement is written in
> strerror(), just:
> 
> 	return(sys_errlist[errnum]);
> 
> causes gcc to issue a warning about the const type being
> dropped.  It's unlikely to be a serious problem, but how should
> it be written to keep the compiler happy? 

Declare strerror() as 

const char *strerror(int)

The programs that use the sys_errlist variable usually seem to declare it 
again without those consts which causes trouble. So I am not so sure if 
this const thing is good after all... Can be solved by changing the 
declaration on those programs but thats not so good.