diff mbox series

manual: Document that feof and ferror are mutually exclusive

Message ID 87ldzo6hby.fsf@oldenburg.str.redhat.com
State New
Headers show
Series manual: Document that feof and ferror are mutually exclusive | expand

Commit Message

Florian Weimer Sept. 18, 2024, 4:45 p.m. UTC
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.

---
 manual/stdio.texi | 7 +++++++
 1 file changed, 7 insertions(+)


base-commit: e64a1e81aadf6c401174ac9471ced0f0125c2912
diff mbox series

Patch

diff --git a/manual/stdio.texi b/manual/stdio.texi
index 8590ae955a..fc507fbc61 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -4168,6 +4168,13 @@  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}.
+
 @deftypevr Macro int EOF
 @standards{ISO, stdio.h}
 This macro is an integer value that is returned by a number of narrow