Source for "integer to ascii" and multiple file search-n-replace

Steve Summit scs at adam.mit.edu
Tue Nov 27 06:22:18 AEST 1990


In article <324 at cti1.UUCP> mpledger at cti1.UUCP (Mark Pledger) writes:
>Maybe nobody is reading my question, but everyone keeps mailing me answers 
>using sprintf() which is actually what I don't want.

I was one of those respondents.  Unfortunately, I did not notice
that you did not want to "resort to print or scanf type
functions" until after I had replied.  Let's look at why so many
people were quick to suggest the use of sprintf.

I mailed you a copy of the frequently-asked questions list.  It
says

	Q. How can I write itoa?
	A: Just use sprintf.

It does not say

	Q. How can I write itoa if I don't care about efficiency?

or

	A: Just use sprintf, unless you need it fast.

Sprintf simply is the recommended function, and it is "fast
enough" in the vast majority of applications.  It is the rare
program that can be significantly sped up with a special-purpose
itoa-type routine, and you gave us no indication of why your
program might be one of them.

I suppose I'll have to make the FAQ list explicit on this point.

                                            Steve Summit
                                            scs at adam.mit.edu

P.S. Before 37 people follow up with 37 examples of rare programs
which DO care about integer to ASCII speed, berating me for my
irresponsibility in apparently advocating inefficiency, let me
say that I have heard of those purported examples before, and in
any case I did not claim that they were nonexistent, merely that
Mark Pledger hadn't shown that his was one of them.



More information about the Comp.lang.c mailing list