Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!hplabs!hao!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.lang.c,net.micro.att Subject: Re: Why doesn't this work? (3B2 problem) Message-ID: <2022@brl-smoke.ARPA> Date: Sun, 23-Mar-86 18:31:39 EST Article-I.D.: brl-smok.2022 Posted: Sun Mar 23 18:31:39 1986 Date-Received: Tue, 25-Mar-86 00:37:01 EST References: <276@birtch.UUCP> Reply-To: gwyn@brl.ARPA Distribution: na Organization: Ballistic Research Lab (BRL) Lines: 20 Xref: dcdwest net.lang.c:7196 net.micro.att:1028 In article <276@birtch.UUCP> ken@birtch.UUCP (Ken B) writes: > char c; > > c=getchar(); > if (c!=EOF) getchar() returns an (int), not a (char). EOF is an (int). You're throwing away some of the bits returned by getchar(), which happens not to matter in this case except when an EOF is returned. >This exact program works correctly on our Pyramid 90x, >so I know its not just my program. Oh, yes it is. The Pyramid presumably treats (char) as (signed char), while the 3B2 treats (char) as (unsigned char). Therefore the pyramid will propagate the sign of the 8-bit subset of the getchar() result that you stashed into c, whereas the 3B2 will not propagate the sign. You have a machine-dependent bug. Didn't "lint" catch this?