Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!sun!pepper!cmcmanis From: cmcmanis%pepper@Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: strins() Keywords: Lattice C Manx Aztec C strins() sprintf Message-ID: <109817@sun.Eng.Sun.COM> Date: 13 Jun 89 19:32:38 GMT References: <0929.AA0929@caleb> <109394@sun.Eng.Sun.COM> <10285@watcgl.waterloo.edu> Sender: news@sun.Eng.Sun.COM Reply-To: cmcmanis@sun.UUCP (Chuck McManis) Organization: Sun Microsystems, Mountain View Lines: 19 In article <10285@watcgl.waterloo.edu> (Geo Swan) writes: > I have never been able to understand why people didn't use sprintf. The answer is fairly simple. sprintf(3) is often entangled with the stdio library. When you use it, it depends on a bunch of other stuff that pulls in most of stdio. Your "simple" function suddenly yanks 14K of code out of the library into your executable. Plus it is a lot more efficient to use strxxx() routines which are simply loops where as sprintf() invokes the _doprnt() parser to figure out how to put together your strings. Generally, sprintf() is easier but strxxx() routines are smaller. If your compiler/linker is smart enough to recognize the difference between when you want full stdio versus just simple printf's that helps. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you. "A most excellent barbarian ... Genghis Kahn!"