home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1885 < prev    next >
Internet Message Format  |  1990-12-28  |  937b

  1. From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr)
  2. Newsgroups: alt.sources
  3. Subject: Re: Fast strcmp() wanted.
  4. Message-ID: <1966@sixhub.UUCP>
  5. Date: 29 Sep 90 20:55:31 GMT
  6.  
  7. In article <1990Sep27.151543.8025@ccs.carleton.ca> dfs@doe.carleton.ca (David F. Skoll) writes:
  8.  
  9. | Hmm... that seems strange.  If the first characters of the strings differ,
  10. | most strcmps will not bother to test the rest.  All that the above code
  11. | possibly saves you is a function call/return.  If this makes such a huge
  12. | difference, then the compiler or your machine's architecture must be pretty
  13. | bad.
  14.  
  15.   If the test of the first character saves a procedure call, then no
  16. matter how good the compiler is it will be faster not to do the call.
  17. -- 
  18. bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
  19.     sysop *IX BBS and Public Access UNIX
  20.     moderator of comp.binaries.ibm.pc and 80386 mailing list
  21. "Stupidity, like virtue, is its own reward" -me
  22.