Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: more on TRUE and FALSE (side-comment) Message-ID: <181@thor.UUCP> Date: 20 Sep 90 14:51:54 GMT References: <9@christmas.UUCP> <1990Sep18.163533.16008@zoo.toronto.edu> Organization: SDRC, Cincinnati Lines: 20 In article <1990Sep18.163533.16008@zoo.toronto.edu>, henry@zoo.toronto.edu (Henry Spencer) writes: > My current favorite definition is: > > #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) > > Note that this is an unsafe macro; on the other hand, it is typically > much faster than one which just calls strcmp every time. Most string > comparisons fail on the first character. And it's slower than one that just calls strcmp every time if your compiler is smart enough to generate in-line code for strcmp! Of course, the beauty of a macro is that you can change it without having to change all the code that uses it. ---- Larry Jones UUCP: uunet!sdrc!thor!scjones SDRC scjones@thor.UUCP 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 Nobody knows how to pamper like a Mom. -- Calvin