tech-userlevel archive

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

Re: strerror(0) POSIX compliance



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:

> On Thu, Mar 24, 2016 at 12:49:31PM +0100, Kamil Rytarowski wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> 
>> POSIX extension to ISO C says:
>> 
>> [CX] [Option Start] If the value of errnum is a valid error number,
>> the message string shall indicate what error occurred; if the value of
>> errnum is zero, the message string shall either be an empty string or
>> indicate that no error occurred; otherwise, if these functions
>> complete successfully, the message string shall indicate that an
>> unknown error occurred. [Option End]
>> 
>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html
>> 
>> Currently we hardcode the following text:
>>         "Undefined error: 0",                   /*  0 - ENOERROR */
>
> I find the rationale for the change in behavior quite questionable and
> any code depending on it is IMO broken. But I don't really care about
> changing the string.

Why do you find it questionable?  If POSIX says the string must be empty
or indicate there is no error, what's wrong with following POSIX?

(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.)

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index