Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!garnet.berkeley.edu!ked From: ked@garnet.berkeley.edu (Earl H. Kinmonth) Newsgroups: comp.unix.xenix Subject: setvbuf() Message-ID: <20422@agate.BERKELEY.EDU> Date: 15 Feb 89 19:11:06 GMT Sender: usenet@agate.BERKELEY.EDU Reply-To: ked@garnet.berkeley.edu (Earl H. Kinmonth) Organization: University of California, Berkeley Lines: 27 In profiling a program using setvbuf(), I observed an unusually high time usage by read and write. After hours of diddling, I found that setvbuf() for SCO Xenix has a different calling sequence from the setvbuf() in BSD UNIX and in the C libraries for Turbo C and other Misery Dos compilers. The common sequence is setvbuf(stream,buffer,type,size) The SCO sequence is setvbuf(stream,type,buffer,size) Since there is no function prototype in , the parameter mismatch will not show up unless you check the return value. (I wasn't.) Even if you do, its not very informative. If you have programs from Misery Dos or BSD UNIX that use setvbuf(), you should probably check for this problem. It only produces slower io since the next action on the stream will cause buffering, but .... RHETORICAL QUESTION: Is there any good explanation for this useless kind of difference, or was some programmer cranked up on weed when he/she/it did the SCO version? LESS RHETORICAL QUESTION: Why no prototype?