I/O implementation in C and C++

rlb rlb at polari.UUCP
Tue May 31 02:01:47 AEST 1988



I find it interesting that both K&R (C) and Stroustrup (C++) give
I/O package implementation examples in which buffer allocation takes
place at the first I/O, rather than in the "open".  The obvious disadvantage
to this is error detection; the programmer is surprised to discover that
although the "open" succeeded, the first I/O fails because of lack of
memory (and of course it is usually easier to isolate the open and test
its status than to do the same for the first I/O).  The only advantage I
can think of is that if an "open" is performed but no I/O is requested,
you've saved a bit of memory.  Are there other advantages?
-Ron Burk



More information about the Comp.lang.c mailing list