Stdio (stderr) buffering question
der Mouse
mouse at mcgill-vision.UUCP
Thu Jun 23 03:44:23 AEST 1988
In article <5027 at sdcsvax.UCSD.EDU>, hutch at net1.ucsd.edu (Jim Hutchison) writes:
> So how many things break if stderr is line buffered? (Meaning that
> when you get a \n or a full buffer WECF.)
Very little will actually break, but it will make stderr next to
useless for debugging. It would force the poor programmer to follow
ever fprintf(stderr,...) with fflush(stderr) to make up for it - why
uglify everyone's code for no good reason?
The efficiency argument is quite bogus (for stderr). Stderr is used
for two things: printing error messages (efficiency irrelevant,
buffering probably acceptable) and printing debugging messages
(efficiency irrelevant, buffering definitely harmful). There are
exceptions to this general rule (tar cvf - being notable), but they are
few enough that inserting a setbuf or setlinebuf call is no great pain.
der Mouse
uucp: mouse at mcgill-vision.uucp
arpa: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.unix.wizards
mailing list