Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!daemon From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Source for "integer to ascii" and multiple file search-n-replace Summary: why "just use sprintf" Message-ID: <1990Nov26.192218.29782@athena.mit.edu> Date: 26 Nov 90 19:22:18 GMT References: <318@cti1.UUCP> <1990Nov20.014110.16982@ux1.cso.uiuc.edu> <324@cti1.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: scs@adam.mit.edu (Steve Summit) Distribution: comp Organization: Thermal Technologies, Inc. Lines: 40 In article <324@cti1.UUCP> mpledger@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@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.