Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!uwm.edu!bionet!agate!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Efficient STRing CoMPares? Message-ID: <11111@dog.ee.lbl.gov> Date: 19 Mar 91 19:17:20 GMT References: <1193@caslon.cs.arizona.edu> <15496@smoke.brl.mil> <1991Mar18.174207.7377@bingvaxu.cc.binghamton.edu> <15510@smoke.brl.mil> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 15 X-Local-Date: Tue, 19 Mar 91 11:17:20 PST In article <15510@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: >... in the vast majority of applications the strings being >compared, even in cases where they match, are contained in different >storage locations. E.g. > if ( StrEq( buffer, "EOF" ) ) ... Of course, you can build yourself a `string pool' system, in which each distinct string appears exactly once, and then two strings match iff their pointers match . . . but this merely offloads the `compare for truly equal' into the string pool system. If you need to do many compares, this is probably worthwhile anyway. -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov