Bug in ANSI C??

Henry Spencer henry at utzoo.uucp
Wed Feb 24 11:51:12 AEST 1988


> ...  The reason
> for allowing the indeterminacy in strcmp()'s return sign when the
> differing characters have the high bit set is simply because that is
> the way C "plain" chars are, so that is in fact how existing implementations
> behave.

Unfortunately, the wording also appears to allow indeterminate results from
strcmp("aX", "a") where X is a high-bit character... which is WRONG!  The
lexical ordering of those two strings is well-defined regardless of char
signedness or collating sequence; allowing implementation-defined results
here makes strcmp almost useless in high-bit environments.
-- 
Those who do not understand Unix are |  Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly.    | {allegra,ihnp4,decvax,utai}!utzoo!henry



More information about the Comp.lang.c mailing list