Defect Report concerning: IEEE Std. 1003.1-1996, ISO/IEC 9945-1:1996 - C API
Clause: 8.2.3.11
PASC Interpretation Ref: pasc-1003.1-23
Topic: pass through of error conditions


This is an unapproved interpretation of PASC 1003.1-1996, ISO/IEC 9945-1:1996 - C API.

Use of the information contained in this unapproved document is at your own risk.

Last update: 10 April,2001


                                                                1003.1-90 #23

	Classification:  Editorial defect

This will be forwarded to the IEEE for incorporation into a future 
errata sheet for the document, as well as an IEEE interpretations
publication, and will be also made available on-line on the IEEE 
SPAsystem.

 _____________________________________________________________________________


	Interpretation Number:	(to be assigned by the IEEE)
	Topic:			pass through of error conditions
	Relevant Sections:	8.2.3.11


Interpretation Request: (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.
    


IEEE Interpretation for 1003.1-1990 (9945-1:1990):
--------------------------------------------------
(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 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() (IEEE Std 2003.1-1992, subclause
8.1.11.4) 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 8.2.3.11 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.

 _____________________________________________________________________________