compare strings, strcmp

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Fri Nov 17 06:30:02 AEST 1989


In article <5205 at mentor.cc.purdue.edu> aic at mentor.cc.purdue.edu (George A. Basar) writes:

|   It is not unsafe, it is just that he was looking for a a way to not
| perform the strcmp if the first chars were unequal.  He stated it was
| unsafe(performance-wise) since the order of evaluation is suspect. So the
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| strcmp may be performed before the test for *(a)==*(b).

  Not in C, it's not. && is evaluated left to right.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.lang.c mailing list