tech-userlevel archive

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

Re: strerror(0) POSIX compliance



On Thu, 24 Mar 2016 14:29:39 +0000 (UTC)
mlelstv%serpens.de@localhost (Michael van Elst) wrote:

> >(I agree that calling strerror(0) is odd and a likely sign of a bug,
> >but that's separate from complying with standards when compliance
> >isn't harmful.)
> 
> Well, if calling strerror(0) is a bug, then usually because it's
> called after an error condition that didn't set errno.

Has that happened to you?  I feel sure that's never happened to me, but
maybe I'm less adventurous.  

IMO it's incorrect to say 0 is an "undefined error".  It's defined as
success by nearly every syscall.  The emitted string should reflect
that, even if [sic] Posix says so.  Perhaps, 

	Success: it is not an error to call strerror with 0.  

--jkl


Home | Main Index | Thread Index | Old Index