Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretation for IEEE Std 1003.1™-1990 IEEE Standard for Information Technology--Portable Operating System Interfaces (POSIX®)

Copyright © 2001 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #23
Topic: pass through of error conditions Relevant Sections:

(Page 191, lines 406-410) Subclause begins

"If any of the functions above return an error condition, the value of errno shall be set to indicate the error condition."

Does this mean that it would be legitimate to implement getchar(), for example, such that it would never return an error indication as long as buffered data were available on stdin?

More generally, must each stream-using function recognize an error whenever an underlying function would do so?

This interpretation is important to the assertion writers for 1003.3.1, because it will determine whether certain assertions are extended and/or conditional.

Interpretation Response
(This interpretation also applies to 2003.1-1992)
Interpretation Number 11 of IEEE Std 1003.1-1988/INT, 1992 Edition, is completely applicable to IEEE Std 1003.1-1990. It states:

Section applies to all functions specified in through in the following manner:

(1) The functions are required to return error indications for those errors specified by the C Standard.
(2) The functions are allowed, but not required, to return error indications for conditions not specified by the C Standard (the standard does not specify the value of errno in such situations).
(3) If the functions return an error condition, and if the error condition is one that would be detected by the underlying function, the functions are required to set errno to the value corresponding to that error condition that is specified for the underlying function.

Assertion 6 for fflush() (IEEE Std 2003.1-1992, subclause is inconsistent with IEEE Std 1003.1-1990 in that it requires that fflush() detect an error under conditions where the C Standard does not require that an error be detected. It would be legitimate to implement getchar() such that no errors were returned while buffered data were available (regardless of the status of the underlying file descriptor) because there is no occasion to detect a read error while data is merely being accessed from the buffer.

Rationale for Interpretation
Interpretation Number 11 of IEEE Std 1003.1-1988/INT, 1992 Edition was originally constrained to apply only to IEEE Std 1003.1-1988 because the interpretations working group thought that the the then-unpublished IEEE Std 1003.1-1990 might contain wording that would create new requirements as to error reporting for C library interfaces.

Since the changes to between 1003.1-1988 and 1003.1-1990 merely clarify the relevant requirements without changing them, the already-adopted Interpretation #11 applies to 1003.1-1990 and to 2003.1-1993.