Bug in ANSI C??
Dick Flanagan
dick at slvblc.UUCP
Sun Feb 14 17:49:42 AEST 1988
In article <2118 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
>In article <241 at oracle.UUCP> rbradbur at oracle.UUCP (Robert Bradbury) writes:
>>On another note; does everyone realize that the current standard allows
>>the results of the str/memcmp() function to be implementation defined
>>if the characters being compared have the high-bit set?
>
>You mean that I can have two identical strings with high bits set, and
>strcmp() could return something other than 0?
No. Equal is equal.
>Or does the problem lie only in deciding lexical order?
The problem lies in that the developer of the run-time routines is free
to decide that strcmp() is comparing *signed* eight-bit numbers, so that
any character with the high-bit set is considered to be *lower* than any
character with the high-bit off. This would mean that the non-equal
returns could differ between one compiler and another.
>While we're on the subject, just what is the meaning of "implementation-
>defined"?
"Left to the discretion of the compiler run-time routine developer."
Dick
--
Dick Flanagan, W6OLD GEnie: FLANAGAN
UUCP: ...!ucbvax!ucscc!slvblc!dick Voice: +1 408 336 3481
INTERNET: slvblc!dick at ucscc.UCSC.EDU LORAN: N037 05.5 W122 05.2
USPO: PO Box 155, Ben Lomond, CA 95005
More information about the Comp.lang.c
mailing list