Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!xanth!kyle
From: kyle@xanth.UUCP
Newsgroups: comp.lang.c
Subject: string equality/comparison optimization
Message-ID: <1500@xanth.UUCP>
Date: Tue, 7-Jul-87 11:08:25 EDT
Article-I.D.: xanth.1500
Posted: Tue Jul  7 11:08:25 1987
Date-Received: Fri, 10-Jul-87 02:16:03 EDT
References: <8011@brl-adm.ARPA> <1711@umn-cs.UUCP>
Lines: 14

In article <1711@umn-cs.UUCP>, herndon@umn-cs.UUCP (Robert Herndon) writes:
> In article <8011@brl-adm.ARPA>, Alan_Cote.DlosLV-Comm@Xerox.COM writes:
> > >Henry Spencer  suggests (assuming a and b have
> > >no side effects)
> > >>#define    STREQ(a, b)    (*(a) == *(b) && strcmp((a), (b)) == 0)
> > >>This makes a considerable speed difference in programs that use strings
> > >>a lot, since string comparisons usually fail on the very first character.
>   This will also greatly slow a good many programs down on machines
> that do not support byte addressing.

But then wouldn't the comparison be just as slow using strcmp(), since it too
must compare bytes?

kyle jones      old dominion university, norfolk, va