Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!think!ames!amdcad!amdahl!dlb!auspyr!john
From: john@auspyr.UUCP (John Weald)
Newsgroups: comp.lang.c
Subject: Re: STREQ
Message-ID: <7316@auspyr.UUCP>
Date: Fri, 10-Jul-87 17:10:48 EDT
Article-I.D.: auspyr.7316
Posted: Fri Jul 10 17:10:48 1987
Date-Received: Sun, 12-Jul-87 15:49:21 EDT
References: <8277@utzoo.UUCP> <7312@auspyr.UUCP>
Reply-To: john@auspyr.UUCP (John Weald)
Organization: Austec, Inc. San Jose
Lines: 33

In article <7312@auspyr.UUCP> mick@auspyr.UUCP (Mick Andrew) writes:
>in article <8277@utzoo.UUCP>, henry@utzoo.UUCP (Henry Spencer) says:
>> 
>>> >>#define    STREQ(a, b)    (*(a) == *(b) && strcmp((a), (b)) == 0)
>>> 
>
>This fine idea must be used with caution.
>
>Note that strcmp() and its siblings correctly handle the case
>of null pointers....
>-- 
>----
>Mick    Austec, Inc.,   San Jose, CA 

You must please excuse Mick, moments after he posted this he went off
on a three week vacation back home to sunny old England. I think his
brain preceded him by about 5 hours!!

Strcmp may well die if handled null pointers, this is surely true on
VMS (and he and I are doing the port to VMS!!). 

BTW:
If I recall the standard AT&T C version of strcmp (SVR2) first does a 
compare to see if the passed pointers point to the same string. Is this
the normal case? I suspect not, again Henry's solution will save this
comparison (assuming that strcmp works like the AT&T C version).

Save your flames as Mick is not around to read them (save them until 8/3)!!!!

John Weald
-- 
UUCP: {sdencore,cbosgd,amdahl,ptsfa,dana}!aussjo!john
UUCP: {styx,imagen,dlb,gould,sci,altnet}!auspyr!john