Checksum: 54716 Lines: 30 Path: utzoo!lsuc!sq!msb From: msb@sq.uucp (Mark Brader) Date: Fri, 19-Feb-88 19:49:54 EST Message-ID: <1988Feb19.194954.736@sq.uucp> Newsgroups: comp.lang.c Subject: Re: Bug in ANSI C?? References: <5331@cit-vax.Caltech.Edu> <241@oracle.UUCP> <2118@bsu-cs.UUCP> <16@dcs.UUCP> Reply-To: msb@sq.UUCP (Mark Brader) Distribution: comp.sys.ibm.pc,comp.lang.c Organization: SoftQuad Inc., Toronto The wording in the November 1987 (the second-latest) draft is: # 4.11.4 Comparison functions # The sign of the value returned by the comparison functions is # determined by the sign of the difference between the values of the # first pair of characters that differ in the objects [ i.e.the strings, in this case ] # being compared. If one of the characters has its high-order bit set, # the sign of the result is implementation-defined. ... # 4.11.4.2 The strcmp function ... # The strcmp function returns an integer greater than, equal to, or # less than zero, according as the string pointed to by [argument] s1 # is greater than, equal to, or less than the string pointed to be s2. Thus strcmp ("xy\300", "xy\100") may return a positive or negative number but not zero. The last time I read this section, I decided that the words about "first pair of characters that differ" meant that the same was true in the case of strcmp ("x\300", "x"); but now I'm not so sure. That was probably the *intent*, but one could consider it to be contradicted by the word "strings" in the last quoted sentence, taken together with the usual notion of lexical ordering. Mark Brader "C takes the point of view SoftQuad Inc., Toronto that the programmer is always right" utzoo!sq!msb, msb@sq.com -- Michael DeCorte