Bug in ANSI C??

Wolf N. Paul wnp at dcs.UUCP
Wed Feb 17 15:02:58 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?  This would be truly a
 >serious flaw in the standard.

The purpose of this would be to allow the use of the "alternate" character
set (= codes > 127) to be used for international language applications.
Languages which have more than 26 alpha characters need the upper half
of the eight-bit code range to implement their languages, and in that
case ignoring the 8th bit would be very counter-productive.

 >Or does the problem lie only in deciding lexical order?  That's not so
 >bad--I wouldn't trust the standard library in that case anyway, since
 >we all have our own opinions about what lexical order is correct.

Similarly, we all have our own opinions about how many unique characters
should be available -- limiting the number to 128 is more restrictive
than necessary, so I think the standard is appropriate.

 >While we're on the subject, just what is the meaning of "implementation-
 >defined"?  E.g., "Oh, by the way, I would avoid comparing strings
 >with high bits set, since the result is implementation-defined.  On
 >this particular system the result is that all disk packs are erased and
 >the system halts."

Hardly. Compiler implementors do want to sell more than a few copies
of their product, and such behaviour would not be conducive to that goal :-)

 >-- 
 >Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi
----
Wolf N. Paul                  Phone: (214) 306-9101 (h)   (214) 404-8077 (w)
3387 Sam Rayburn Run          UUCP: ihnp4!killer!{dcs, doulos}!wnp
Carrollton, TX 75007          INTERNET: wnp at dcs.UUCP       ESL:  62832882
Pat Robertson does NOT speak for all evangelical Christians--not for me, anyway!
-- 
Wolf N. Paul                  Phone: (214) 306-9101 (h)   (214) 404-8077 (w)
3387 Sam Rayburn Run          UUCP: ihnp4!killer!{dcs, doulos}!wnp
Carrollton, TX 75007          INTERNET: wnp at dcs.UUCP       ESL:  62832882
Pat Robertson does NOT speak for all evangelical Christians--not for me, anyway!



More information about the Comp.lang.c mailing list