Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!munnari.oz.au!mudla!ok From: ok@mudla.cs.mu.OZ.AU (Richard O'Keefe) Newsgroups: comp.lang.c Subject: Re: compare strings, strcmp Keywords: strcmp,strings Message-ID: <2735@munnari.oz.au> Date: 17 Nov 89 05:04:49 GMT References: <4463@blake.acs.washington.edu> <11605@smoke.BRL.MIL> <308@charyb.COM> <1632@crdos1.crd.ge.COM> Sender: news@cs.mu.oz.au Lines: 15 In article <1632@crdos1.crd.ge.COM>, davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) writes: : In article <308@charyb.COM> dan@charyb.UUCP (Dan Mick) writes: : | In article <11605@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: : | >#define StrEq( a, b ) (*(a) == *(b) && strcmp( a, b ) == 0) /* UNSAFE */ : | : | Why the UNSAFE comment? This looks like utterly standard C to me... : : I can only speculate, but strcmp can give memory faults if the string : is not properly terminated. There may be other reasons I'm missing, I : lost a day's news and don't have the original. I thought "unsafe" was common C jargon for a macro that looks like a function but may evaluate one or more arguments more than once. This is such a macro: if a or b contains a function call or an assignment you may be in trouble.