Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!nuug!ifi!jar From: jar@ifi.uio.no (Jo Are Rosland) Newsgroups: comp.lang.c Subject: Re: New 'n' Improved comp.lang.c FAQ List Message-ID: Date: 2 Apr 91 13:03:47 GMT Article-I.D.: holmenko.JAR.91Apr2150326 References: <910401.0xf001@etiquette.uu.net> <1991Apr1.203024.19679@unlv.edu> <31946@shamash.cdc.com> Sender: jar@ifi.uio.no (Jo Are Rosland) Organization: University of Oslo, Norway Lines: 34 In-Reply-To: bls@u02.svl.cdc.com's message of 2 Apr 91 03:03:43 GMT In article <31946@shamash.cdc.com> bls@u02.svl.cdc.com (Brian Scearce) writes: grover@big-joe.cs.unlv.edu (Kevin Grover) writes: > Apparently non-obvious April Fool's Day bogus account posts: 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; } Not to be picky, but char *itoa(int i) { static char retbuf[7]; /* biggest int: 32767 */ sprintf(retbuf, "%d", i); return retbuf; } is really, *really* correct, provided int is stored two's-complement in 16 bits. FLAME SHIELD: This of course is not a portable assumption, and the whole function is redundant, and it's interface stinks, and the original function at least had some value as comic relief whereas this one has none. But all of this is probably getting rather silly, and not at all as entertaining as the original posting, sorry ;-( -- Jo Are Rosland jar@ifi.uio.no