svn commit: r187805 - head/lib/libc/stdio
brde at optusnet.com.au
Wed Jan 28 03:15:33 PST 2009
On Wed, 28 Jan 2009, Roman Divacky wrote:
> On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote:
>> Remove comment about clearerr() being the only method of clearing
>> the EOF indicator, fseek() may also be used for this.
fseek() can't always be used for this, since fseek() fails for unseekable
files (even SEEK_CUR fails then). However, when it works, it has the
advantage(?) of not clobbering the error indicator.
The comment was also wrong because the EOF indicator can also be cleared
by clearerr_unlocked() in some cases and by fseeko() in the same cases as
> why not saying what you state in the commit message in the man page
> instead of removing the info entirely?
Well, neither C99 nor POSIX say this for feof().
The man page still says that the error indicator can only be cleared by
clearerr(). This is false since a sucessful rewind() clears both
indicators, and the indicator can be cleared by clearerr_unlocked() in
I think the man page is trying to make the false claims that the
indicators are not cleared as side effects and is not trying to list
all the functions that do clear the indicators as side effects, and
that it shouldn't try to do the latter. The list for the EOF indicator
may be quite long and system-and-time-dependent since it includes the
closure of all functions that call fseek(), or fseeko()). For both
indicators, the list includes the closure of all functions that call
clearerr() or clearerr_unlocked(). Perhaps no such functions in
standard libraries are permitted to operate on application streams,
but this is unclear.
More information about the svn-src-head