Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: more on TRUE and FALSE (side-comment) Message-ID: <14084:Sep2105:38:0890@kramden.acf.nyu.edu> Date: 21 Sep 90 05:38:08 GMT References: <1990Sep18.163533.16008@zoo.toronto.edu> <181@thor.UUCP> Organization: IR Lines: 17 In article <181@thor.UUCP> scjones@thor.UUCP (Larry Jones) writes: > 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) > 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! Which is why it should be #define STREQ(a,b) ( *(a) == *(b) && *(a) && !strcmp((a)+1, (b)+1) ) instead. Probably calling strcmp ``strdiff'' will answer the original question. ``if (strdiff(a,b))'' makes sense, right? ---Dan