Re: about STREQ
From: Mabden (mabden_at_sbcglobal.net)
Date: 05/20/04
- Next message: Christian Bau: "Re: volatile qualified parameters"
- Previous message: Case -: "Re: socket programming"
- In reply to: Leor Zolman: "Re: about STREQ"
- Next in thread: Leor Zolman: "Re: about STREQ"
- Reply: Leor Zolman: "Re: about STREQ"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 May 2004 06:46:20 GMT
"Leor Zolman" <leor@bdsoft.com> wrote in message
news:nq7oa0lhgglpvfl258i4s3flcluueqb3n8@4ax.com...
> On Thu, 20 May 2004 02:30:32 +0000 (UTC), Sam Dennis
> <sam@malfunction.screaming.net> wrote:
>
> >Sam Dennis wrote:
> >> #define STREQ(a, b) (*(a) == *(b) && strcmp((a) + !!*(a), (b) +
!!*(a)))
> >
> >Oops: should be !strcmp( ... ), of course.
>
> That really underscores what I think is the most important point out of
> this thread (which has already been articulated by Thomas Matthews): the
> price for this chicanery is just too high, even if it results in a modicum
> of performance increase (and it won't necessarily). I was going to say
that
> earlier, and then got so wrapped up in minutiae that I forgot to.
>
Agreed. This stuff is bad enough for those of us who consider ourselves
experts (notice how I weasel my way into that group), now have a newbie try
to make sense of it...
I mean, if you're worried about optimizations, why are you calling strcmp()
at all...
> Mabden wrote:
> At least make the macro:
> #define STREQ(a, b) (*(a) == *(b) && strcmp((a+1), (b+1)) == 0)
Plus, it would only really help if you are reasonably certain that the two
strings will *usually* differ in the first character, so it would have to be
a specific data group. Hence my comment about calling the macros with the
second character (since you already know the first ones match, and if you
know the data that well - like part numbers or something - you would know
there's going to be a second char)
-- Mabden
- Next message: Christian Bau: "Re: volatile qualified parameters"
- Previous message: Case -: "Re: socket programming"
- In reply to: Leor Zolman: "Re: about STREQ"
- Next in thread: Leor Zolman: "Re: about STREQ"
- Reply: Leor Zolman: "Re: about STREQ"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|