about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-09-27 11:41:12 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-09-27 11:41:14 +0200
commitf47596fcfe32ef96ba9b322a414803b25b8ce608 (patch)
treeae6901e9264238364a2ede110ebb3aa54a748803
parent1d72fa3cfa046f7293421a7e58f2a272474ea901 (diff)
downloadglibc-f47596fcfe32ef96ba9b322a414803b25b8ce608.tar.gz
glibc-f47596fcfe32ef96ba9b322a414803b25b8ce608.tar.xz
glibc-f47596fcfe32ef96ba9b322a414803b25b8ce608.zip
manual: Document that feof and ferror are mutually exclusive
This is not completely clear from the C standard (although there
is footnote number 289 in C11), but I assume that our implementation
works this way.

Reviewed-by: DJ Delorie <dj@redhat.com>
-rw-r--r--manual/stdio.texi9
1 files changed, 9 insertions, 0 deletions
diff --git a/manual/stdio.texi b/manual/stdio.texi
index 8590ae955a..c7a2b4a9a1 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -4168,6 +4168,15 @@ check indicators that are part of the internal state of the stream
 object, indicators set if the appropriate condition was detected by a
 previous I/O operation on that stream.
 
+The end of file and error conditions are mutually exclusive.  For a
+narrow oriented stream, end of file is not considered an error.  For
+wide oriented streams, reaching the end of the underlying file can
+result an error if the underlying file ends with an incomplete multibyte
+sequence.  This is reported as an error by @code{ferror}, and not as an
+end of file by @code{feof}.  End of file on wide oriented streams that
+does not fall into the middle of a multibyte sequence is reported via
+@code{feof}.
+
 @deftypevr Macro int EOF
 @standards{ISO, stdio.h}
 This macro is an integer value that is returned by a number of narrow