From: Alain Magloire Message-Id: <199904070259.WAA10720@spock2.ECE.McGill.CA> Subject: Re: v2.03 release: what else has to be done? To: djgpp-workers AT delorie DOT com Date: Tue, 6 Apr 1999 22:59:55 -0400 (EDT) In-Reply-To: <7aa6585.243c053e@aol.com> from "Kbwms@aol.com" at Apr 6, 99 08:47:58 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Bonjour > > It's the same as doing i = i++; // undefined behavior. > > Your example is specious at best. > It is right on target, it describes an undefined behavior that no STDs make promises on. They are both compiler/library/system/whatever specific. > > > > IMO, it is ill-advise to allow fflush() on an input stream even > > if at first it may look like a usefull extension. > > > > And I disagree. Certainly no change there. > > Suppose we define fflush(FILE *stream) as > > flush the buffer associated with the stream > > If it is decided that fflush() on an input stream should be defined, > how will that affect your work? It will not, I try to avoid non-portable code. Usually when people do fflush(stdin), they want to discard the input keyboard. A portable way maybe tcflush(STDIN_FILENO, TCIFLUSH); or just plain int c; do { c = getchar(); } while (c != EOF && c != '\n'); But if you want to do implement it; int fflush (FILE * stream) { ..... if (stream) { int fd = fileno(stream); /* discard the allocated library buffer */ .... /* discard whatever the system/device had */ if (isatty(fd)) { tcflush(fd, TCIFLUSH); tcflush(fd, TCOFLUSH); } ..... } ... } But this not as trivial as you may think. -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!