Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!unhd.unh.edu!al From: al@unhd.unh.edu (Anthony Lapadula) Newsgroups: comp.lang.c Subject: Re: New 'n' Improved comp.lang.c FAQ List Message-ID: <1991Apr2.173253.13858@unhd.unh.edu> Date: 2 Apr 91 17:32:53 GMT References: <1991Apr1.203024.19679@unlv.edu> <31946@shamash.cdc.com> <3739@jethro.Corp.Sun.COM> Organization: University of New Hampshire Lines: 27 In article <3739@jethro.Corp.Sun.COM> fguille@France.Sun.COM writes: > > Almost, but not quite, Mr. Grover. The *really* correct version of this: > > char *itoa(int i) > { > static char retbuf[5]; /* biggest int: 32768 */ > sprintf(retbuf, "%d", i); > return retbuf; > } >[....] > > static char retbuf[6]; /* biggest int: 32768 */ I wanted to stay out of this discussion. I really did.... I know this thread grew out of an April Fool's joke, but I just can't let this pass. Even if you know that your system has 16-bit int's (which is a poor assumption -- we should know by now that all the world's a VAX :-), itoa could still be requested to print out, say, "-20000", which requires a buffer of size *7*. -- Anthony (uunet!unhd!al, al@cs.unh.edu) Lapadula "I would agree with you if you were right." -- Dr Sayer, "Awakenings"