more on TRUE and FALSE (side-comment)

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Sep 21 15:38:08 AEST 1990


In article <181 at thor.UUCP> scjones at thor.UUCP (Larry Jones) writes:
> In article <1990Sep18.163533.16008 at zoo.toronto.edu>, henry at 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



More information about the Comp.lang.c mailing list