stdio buffering considered harmful

noel at cubsvax.UUCP noel at cubsvax.UUCP
Sat Aug 6 04:48:02 AEST 1983


How about a load-time option which would make stdio buffer line-by line?
One could "cc dumb.c -lflush" and /lib/libflush.a would be a version of
some subset of stdio which did whatever one considers best -- I vote
for either line-by-line or per-printf flushes on ALL output files.
This would obviate the need for inserting fflush()es to extract the
output of a program which bombs due to illegal behaviour like "bus error"
"segmentation violation", funny asynchronous behaviour, etc., etc..

Of course if you really felt you needed to optimize for file writes
and only flush for pipes and ttys, you could have yet another version
of the load library which did that.  Of course the different versions
of the library would be #ifdef compilations.

-- 
	Noel Kropf		harpo!rocky2!cubsvax!noel
	1002 Fairchild		philabs!cmcl2!rocky2!cubsvax!noel
	Columbia University
	New York NY 10027	212-280-5517



More information about the Comp.unix.wizards mailing list