Mail Archives: djgpp-workers/1999/04/06/11:06:59
> fflush(fpw);
> /*fsync(fileno(fpw));*/
I suspect this is a "bug" in dos, but that most unix programs that
care would expect it to work without fsync. If calling fsync is what
we need to do to make fflush work like unix, I have no problem adding
it.
> Oh, now we are at it, ANSI C9x (Annex J.2, page 557) says trying to
> fflush an input stream causes undefined behaviour, "with or without
> the issuance of a diagnostic message". Maybe we should consider
> generating some warning?
I don't like silent failures; they generate FAQs. I'd prefer we
either print a warning or make it work the way people "expect" it to
work.
> But fflush.c nevertheless does:
>
> f->_flag &= ~_IOUNGETC;
>
> I assume this *can* have effect on an input stream. Which behaviour is
> intented?
If it's not going to do anything, it should do nothing. We currently
don't have any specific checks for read streams, so you get the
"undefined" behavior (I think my todo mbox has a patch to change
this).
- Raw text -