🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #256

Re: The Super strcat routine for lists ?? (HELP)

#256
From: Ken Buck
Date: Sun, 08 Apr 1990 15:47
19 lines
1727 bytes
In article <11817@ttidca.TTI.COM> svirsky@ttidca.TTI.COM (Bill Svirsky) writes:
  [stuff deleted]
>Or less obviously as:
>  strcat(strcat(strcat(strcpy(sys_string, "ls -l "), directory), "/"),filename);
>However, the printf functions have a relatively large overhead.  ...

This is true, of course, because the inclusion of sprintf() requires the
compiler provide the various conversion routines needed to interpret different
types of arguments, including >floating-point< types...

Note, however, that multiple calls to strcat() do incur an overhead as well,
in terms of: setting up function calling sequences, need to call strlen()
internally on each call to strcat(), and we needn't mention the ugliness...
[Translates into: bigger code than necessary, and perhaps *lots* slower...]
This can all be avoided, if you still don't want sprintf()+overhead, by
writing your variable-arg "catenate" routine such that it doesn't call strcat()
to do the catenation, but rather performs the catenation itself (via string-
traveling loops).
Personally, I prefer the simplicity of sprintf(), if memory is not a hassle.
Technical Details
Message-ID: <1990Apr8.154708.12231@granite.cr.bull.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!bbn!granite!buck
References: <1990Apr3.023410.6401@cunixf.cc.columbia.edu> <1990Apr3.195337.2453@hellgate.utah.edu> <11817@ttidca.TTI.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!bbn!granite!buck
From: buck@granite.cr.bull.com (Ken Buck)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: The Super strcat routine for lists ?? (HELP)
Keywords: strcat, lists
Message-ID: <1990Apr8.154708.12231@granite.cr.bull.com>
Date: 8 Apr 90 15:47:08 GMT
References: <1990Apr3.023410.6401@cunixf.cc.columbia.edu> <1990Apr3.195337.2453@hellgate.utah.edu> <11817@ttidca.TTI.COM>
Reply-To: buck@granite.cr.bull.com (Ken Buck)
Organization: Bull HN Information Systems Inc.
Lines: 19