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