On Mon, 27 Apr 2020 03:35:46 +0000, Seymour J Metz wrote: >K&R did not require char to be at least 8 bits, but ANSI did. > >I wonder what C did on a ones' complement machine if a string contained a -0 >character? > POSIX specifies that the component characters should be compared as if unsigned.
Grrr. Pascal on CDC 6600 (its birthplace) had the idiosyncratic type ALFA, a 60-bit word containing ten 6-bit characters. Comparison operators on ALFAs treated then as 60-bit signed integers. 6600 had no hardware compare instruction, so relational operators on ALFAs did a (ones-complement) subtraction and checked the sign. My co-worker complained to Wirth, I don't know with what effect. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
