Submitter: Stoughton (US)
Submission Date: 2006-03-20
Reference Document: XSH Aardvark, ERN 137
Summary: Is an implementation permitted to return an
empty string for
This is a potential defect forwarded from the Austin Group.
Is an implementation of strerror permitted to return an empty
string if there is no associated error message for the given
strerror()cannot be empty. The C Standard says
It doesn't state that the message cannot be empty, but the fact that it uses the word "message" means that any interpretation that allows this message to be empty would also have to allow the diagnostic messages produced by the compiler to be empty. Clearly such an interpretation is very much not intended. Note that the relationship between the term "diagnostic message" and the "message" produced by
strerrorshall map any value of type
intto a message.
strerror()is clear from section 3.10:
message belonging to an implementation-defined subset of the implementation's message output
On the other hand, some have argued that "An implementation-defined subset" does not preclude the empty string from being included in the set of messages, provided the implementation has defined the error that equates to the message.
Suggested Technical Corrigendum
Change 184.108.40.206, p2 from:
The strerror function maps the number inTo:
errnumto a message string. Typically, the values for
strerror()shall map any value of type
intto a message.
The strerror function maps the number in
errnumto a message string. If the value of
errnumis a valid error number, the message string shall indicate what error occurred; otherwise, if this functions completes successfully, the message string shall indicate that an unknown error occurred. Typically, the values for
errno, but strerror shall map any value of type int to a message.
Proposed Committee Response
The intention is to allow implementations to decide what form of message is appropriate. There is no consensus to make the suggested change or any change along this line.