Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!brutus.cs.uiuc.edu!jarthur!aqdata!sullivan From: sullivan@aqdata.uucp (Michael T. Sullivan) Newsgroups: comp.lang.c Subject: Re: compare strings, strcmp Message-ID: <1989Nov17.155143.2758@aqdata.uucp> Date: 17 Nov 89 15:51:43 GMT References: <309@charyb.COM> Organization: aQdata, Inc. Western Region -- San Dimas, CA Lines: 20 From article <309@charyb.COM>, by will@charyb.COM (Will Crowder): > 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... > > This macro is "unsafe" because the macro arguments a and b are used twice, > hence possible side effect difficulties... I once read (Indian Hills Style Guide???) that if a macro doesn't behave EXACTLY like a function (i.e. evaluates parameters once, doesn't assign to arguments, etc.) that it should be named in all caps. Thus, a person using the macro will know to be careful with it. Applies here, eh? -- Michael Sullivan uunet!jarthur.uucp!aqdata!sullivan aQdata, Inc. San Dimas, CA