Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!brl-adm!brl-smoke!smoke!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: Re: SUN C compiler bug? Message-ID: <2190@brl-smoke.ARPA> Date: Sat, 29-Mar-86 00:28:52 EST Article-I.D.: brl-smok.2190 Posted: Sat Mar 29 00:28:52 1986 Date-Received: Mon, 21-Apr-86 00:32:37 EST Sender: news@brl-smoke.ARPA Lines: 9 When dissimilar types occur in an expression, they are converted into comparable types according to rules you can find in K&R, better in Harbison&Steele, better still in the X3J11 draft. The conversion involves widening smaller types, not shrinking fatter ones. Since 128 is an (int), the (char) x should have been widened to (int) before the < comparison. On the other hand, you have the problem that signed chars will never widen to something >= 128 (assuming 8-bit byte), so the loop would never terminate. Yes it's a bug, but the code is buggy too.