Xref: utzoo comp.lang.c:10526 comp.lang.c++:1211 Path: utzoo!attcan!uunet!husc6!bbn!mit-eddie!ll-xn!ames!pacbell!att!ihnp4!arizona!mike From: mike@arizona.edu (Mike Coffin) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: I/O implementation in C and C++ Message-ID: <5679@megaron.arizona.edu> Date: 1 Jun 88 14:27:41 GMT References: <462@polari.UUCP> Organization: U of Arizona CS Dept, Tucson Lines: 17 From article <462@polari.UUCP>, by rlb@polari.UUCP (rlb): > > > 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 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? For one thing, it makes setbuf(3s) possible. You could instead add an optional argument to "open" to specify a buffer, but this mucks up the interface for lots of users who never use setbuf. -- Mike Coffin mike@arizona.edu Univ. of Ariz. Dept. of Comp. Sci. {allegra,cmcl2,ihnp4}!arizona!mike Tucson, AZ 85721 (602)621-4252