Puts replaced by printf? (Was: Re: Bug in csh (history, "!a%100s"))
Jeff Beadles
jeff at quark.WV.TEK.COM
Wed Jul 12 01:06:35 AEST 1989
In article <774 at sbsvax.UUCP> greim at sbsvax.UUCP (Michael Greim) writes:
>As to "puts() will never be slower than printf()": I recall reading
>somewhere that some people think about implementing puts() using printf().
You ARE kidding, right? Puts can be something ridiculously simple.
Something like this would work:
(I know that it's not "correct" but the concept is. :-)
puts(string)
char string
register char *cp = string;
while(*cp)
putchar(*cp++);
putchar('\n');
Why use printf for something this simple?
Would they do something like:
#define puts(x) printf("%s\n", x);
Ack.
-Jeff
--
Jeff Beadles Utek Sustaining Engineering, Tektronix Inc.
jeff at quark.WV.TEK.COM
More information about the Comp.sources.bugs
mailing list