[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fflush after ungetc
From: |
Bruno Haible |
Subject: |
Re: fflush after ungetc |
Date: |
Sun, 9 Mar 2008 22:13:23 +0100 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> I'm starting to waffle on what POSIX
> requires. Maybe it's worth asking the Austin Group after all?
Yes, thanks for asking the Austin Group.
> Swapped comments.
> ...
> Cygwin listed twice. But be aware that there was a change in cygwin behavior
> from 1.5.25-10 to 1.5.25-11, due to this thread.
Oops, fixed.
> Now, on to my waffling:
>
> > /* Check that fflush after a non-backup ungetc() call discards the ungetc
> > buffer. This is mandated by POSIX
> > <http://www.opengroup.org/susv3/functions/ungetc.html>:
> > "The value of the file-position indicator for the stream after
> > reading or discarding all pushed-back bytes shall be the same
> > as it was before the bytes were pushed back." */
>
> fflush neither reads nor discards pushed-back bytes (ungetc states that only
> fseek, fsetpos, and rewind discard bytes).
Let's see what Austin decides. gnulib now implements options 1b+2b (in the
terms of my earlier mail); I'm ready to change it, whatever gets decided.
> ungetc is just a portability pitfall - maybe we're just better off
> documenting
> that portable programs never call more than one ungetc on a stream
This restriction is already well known.
> and never with a byte different than what was read
ungetc with a different byte is insane anyway. I'm discussing it only because
the standard allows it.
Bruno
- Re: new module 'freadseek', (continued)
- Re: fflush after ungetc, Eric Blake, 2008/03/07
- Message not available
- Re: fflush after ungetc, Eric Blake, 2008/03/07
- Re: fflush after ungetc, Bruno Haible, 2008/03/09
- 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 <=
- 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
- Re: fflush after ungetc, Bruno Haible, 2008/03/30
- Re: Cygwin ftell bug, Bruno Haible, 2008/03/06