Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Nov 2000 15:24:35 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Garance A Drosihn <drosih@rpi.edu>
Cc:        Robert Nordier <rnordier@nordier.com>, hackers@FreeBSD.ORG
Subject:   Re: fclose vs ferror (from libc/getcap)
Message-ID:  <3A1B66A3.D29C8565@newsguy.com>
References:  <200011201020.MAA23349@siri.nordier.com> <p04330104b640abfaf13d@[128.113.24.47]> <3A1B5592.89A7BBE2@newsguy.com> <p04330100b641090d2474@[128.113.24.47]>

next in thread | previous in thread | raw e-mail | index | archive | help
Garance A Drosihn wrote:
> 
> >Undefined behavior means anything goes. On a standard, it means the
> >behaviour is implementation-defined (which may be undefined or not).
> 
> But if "anything goes", then that you can not expect it to
> work; certainly not when porting to other platforms.

Sure enough. The behavior of any function on a closed FILE* is not
defined by standards.

> I am not saying that what freebsd does is wrong.  But Robert
> said that "[that code is a silly thing], but if I was porting
> some hairy old C code I'd tend to expect it to work."

> It seems to me that if the behavior is explicitly undefined
> then you can NOT expect much of anything when porting.

He said he would _tend_ to expect it to work. To me, that means the code
is dubious, but is likely to work.

> >  And notice that ferror() is not an access to the stream.
> 
> In the section I quoted from unix spec, "stream" refers to the
> variable passed to fclose (though that isn't obvious, because I
> didn't copy the formatting).  ferror certainly does access that
> variable.

MMmmmm. That's a dubious interpretation. The variable is a handle to the
stream, not the stream itself. Are you sure of the SUS wording?

-- 
Daniel C. Sobral			(8-DCS)

dcs@newsguy.com
dcs@freebsd.org
capo@united.bsdconspiracy.net

	"All right, Lieutenant, let's see what you do know. Whatever it is,
it's not enough, but at least you haven't done anything stupid yet."
	"I've hardly had time, sir."
	"There's a naive statement."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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