[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fflush after ungetc
From: |
Eric Blake |
Subject: |
Re: fflush after ungetc |
Date: |
Fri, 07 Mar 2008 06:14:13 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Vincent Lefevre on 3/7/2008 6:02 AM:
| On 2008-03-06 22:58:16 -0700, Eric Blake wrote:
| [HP-UX 11]
|> | When reading from the pipe:
|> | c = '#'
|> | c = 'i'
|> | ungetc result = '@'
|> | c = <EOF>
|> | c = <EOF>
|>
|> Bug. C99 is quite clear that implementations shall provide at least
|> one byte of ungetc buffering for all streams, and that it cannot
|> fail if there was a prior fgetc.
|
| As far as C99 is concerned, there is no bug: fflush() on an input
| stream is an undefined behavior. So, anything can occur.
I stand corrected in this instance. Even in POSIX, fflush on a
non-seekable input stream is undefined (it is only fflush on seekable
input that was given definition by POSIX). POSIX is also explicit that
when sharing a file description between two processes, the behavior is
undefined if both read data from that pipe.
But my questions about fflush on seekable input streams after ungetc still
remain.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH0T+l84KuGfSFAYARArHoAJwIPHw/SZVlojKauz6hmVIZssKDhACfe18u
aaSPqKShLpoUA3HI7gn7zzY=
=Ccdi
-----END PGP SIGNATURE-----
- Re: new module 'freadseek', Eric Blake, 2008/03/01
- Message not available
- Re: fflush after ungetc, Eric Blake, 2008/03/26
- Re: fflush after ungetc, Bruno Haible, 2008/03/06
- Re: fflush after ungetc, Eric Blake, 2008/03/06
- Re: fflush after ungetc, Bruno Haible, 2008/03/09
- Re: fflush after ungetc, Eric Blake, 2008/03/29
- Re: fflush after ungetc, Eric Blake, 2008/03/29
- Re: fflush after ungetc, Bruno Haible, 2008/03/29
- Re: fflush after ungetc, Eric Blake, 2008/03/29
- Re: freadseek, Bruno Haible, 2008/03/30