Re: about STREQ

From: Mabden (mabden_at_sbcglobal.net)
Date: 05/20/04


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


Relevant Pages

  • Re: Drop down list quicker selection
    ... I'm still unsure though, how to go about setting the macro up from the ... "Roger Govier" wrote: ... With regard to listing the entries from the first character, ...
    (microsoft.public.excel.newusers)
  • Re: Highlight mergefields
    ... saving or, perhaps better still, permanently shade the first character of ... then use a macro to add/remove the Charformat switch as needed. ... Without the Charformat switch, the shading won't come through in the output. ... >>> I have set up a macro to highlight fields so that the printed document ...
    (microsoft.public.word.vba.general)
  • Re: How to determine the first character in math mode
    ... I am trying to write a macro that will be used in math mode. ... this I would like to detect if the first character of an argument is ... Your \firstoftest is /not/ a minus: ...
    (comp.text.tex)
  • Re: Beginner Problems
    ... For example, question one I know I could do an index search, ... that compares the first character of the name I am looking for, ... there is a match I compare the second character and so on. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: mail merge -- attachment at bottom of email
    ... The macro was really only designed for use with Microsoft Outlook. ... I've been using the Doug Robbins instructions for attaching files to a ... the first character of my message is replaced ... Second question: It's a little confusing to attach files at the top of ...
    (microsoft.public.word.mailmerge.fields)

Loading