compare strings, strcmp
Richard O'Keefe
ok at mudla.cs.mu.OZ.AU
Fri Nov 17 16:04:49 AEST 1989
In article <1632 at crdos1.crd.ge.COM>, davidsen at crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
: In article <308 at charyb.COM> dan at charyb.UUCP (Dan Mick) writes:
: | In article <11605 at smoke.BRL.MIL> gwyn at 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.
More information about the Comp.lang.c
mailing list