Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jan 2009 22:15:22 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        svn-src-head@freebsd.org, Tom Rhodes <trhodes@freebsd.org>, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r187805 - head/lib/libc/stdio
Message-ID:  <20090128212904.E45316@delplex.bde.org>
In-Reply-To: <20090128081914.GA22309@freebsd.org>
References:  <200901280111.n0S1BL7n003092@svn.freebsd.org> <20090128081914.GA22309@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Jan 2009, Roman Divacky wrote:

> On Wed, Jan 28, 2009 at 01:11:21AM +0000, Tom Rhodes wrote:
>> Log:
>>   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
by fseek().

> 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
some cases.

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.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090128212904.E45316>