Undelivered mail
MAILER%ALASKA.BITNET at CUNYVM.CUNY.EDU
MAILER%ALASKA.BITNET at CUNYVM.CUNY.EDU
Mon Mar 14 01:40:16 AEST 1988
Subject: Re: Don't use Scanf()
[Non-Deliverable: User does not exist or has never logged on]
Reply-To: Info-C at BRL.ARPA
Received: From UWAVM(MAILER) by ALASKA with Jnet id 1172
for SXJVK at ALASKA; Sun, 13 Mar 88 06:14 AST
Received: by UWAVM (Mailer X1.25) id 7080; Sun, 13 Mar 88 07:14:16 PST
Date: Sun, 13 Mar 88 00:58:41 GMT
Reply-To: Info-C at BRL.ARPA
Sender: Info-C List <INFO-C at NDSUVM1>
From: Henry Spencer <henry at utzoo.uucp>
Subject: Re: Don't use Scanf()
Comments: To: info-c at BRL-SMOKE.arpa
To: Vic Kapella <SXJVK at ALASKA>
> For example, if you want to print a string fast, you would write
> a routine that uses only putc...
!!NO!! If you want to print a string fast, you use fputs and insist that
your supplier implements it properly. Putc has to do things like buffer-
overflow checking on every character; a fast implementation of fputs can
inspect the buffer *once*, note that there is room for N more characters,
copy N characters at high speed, and then update counts and so forth *once*.
This is a major efficiency win over putc if you are doing it a lot.
Unfortunately, not all implementors make the effort to make stdio fast.
In general, System V stdios are fast and 4BSD ones are not. (There are
exceptions to this, both ways, and I believe the 4BSD one is going to be
improved.)
--
Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry
More information about the Comp.lang.c
mailing list