.
Last update: 1997-05-20
9945-1-90 #23
Classification: Editorial defect
_____________________________________________________________________________
Topic: pass through of error conditions
Relevant Sections: 8.2.3.11
Defect Report:
-----------------------
(Page 191, lines 406-410)
Subclause 8.2.3.11 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.
WG15 response for ISO/IEC 9945-1:1990 (IEEE Std 1003.1-1990)
--------------------------------------------------
(This interpretation also applies to 13210:1994)
Interpretation Number 11 of ISO/IEC 9945-1-1988/INT, 1992 Edition,
is completely applicable to ISO/IEC 9945-1:1990. It states:
Section 8.2.3.11 applies to all functions specified in 8.2.3.1
through 8.2.3.10 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() (ISO/IEC 13210:1994, subclause
8.1.11.4) is inconsistent with ISO/IEC 9945-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 1003.1-1988/INT, 1992
Edition was originally constrained to apply only to IEEE
1003-1-1988 because the interpretations working group thought
that the the then-unpublished ISO/IEC 9945-1:1990 might contain
wording that would create new requirements as to error reporting
for C library interfaces.
Since the changes to 8.2.3.11 between 1003.1-1988 and
9945-1:1990 merely clarify the relevant requirements without
changing them, the already-adopted Interpretation #11 applies to
9945-1:1990 and to 13210:1994.
_____________________________________________________________________________