From owner-freebsd-hackers Tue Nov 21 21:14: 1 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id 2D9AB37B4C5 for ; Tue, 21 Nov 2000 21:13:59 -0800 (PST) Received: from newsguy.com (p51-dn02kiryunisiki.gunma.ocn.ne.jp [211.0.245.116]) by peach.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id OAA07090; Wed, 22 Nov 2000 14:13:33 +0900 (JST) Message-ID: <3A1B5592.89A7BBE2@newsguy.com> Date: Wed, 22 Nov 2000 14:11:46 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,pt-BR MIME-Version: 1.0 To: Garance A Drosihn Cc: Robert Nordier , hackers@FreeBSD.ORG Subject: Re: fclose vs ferror (from libc/getcap) References: <200011201020.MAA23349@siri.nordier.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Garance A Drosihn wrote: > > The "single Unix spec" says: > After the call to fclose(), any use of stream causes > undefined behavior. > > FreeBSD's own man page for fclose says: > [fclose returns 0 or EOF]. In either case, no further > access to the stream is possible. > > Neither of those indicate that anyone should "expect it to > work", no matter what language they are programming in. There > is nothing in the description for ferror which implies that it > is some magical exception to the above rules. Undefined behavior means anything goes. On a standard, it means the behaviour is implementation-defined (which may be undefined or not). And notice that ferror() is not an access to the stream. -- 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