Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Comparing chars to constants Message-ID: <1509@haddock.ISC.COM> Date: Mon, 26-Oct-87 21:11:14 EST Article-I.D.: haddock.1509 Posted: Mon Oct 26 21:11:14 1987 Date-Received: Thu, 29-Oct-87 05:01:39 EST References: <4663@elroy.Jpl.Nasa.Gov> <2515@mmintl.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 10 In article <2515@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: >In article <4663@elroy.Jpl.Nasa.Gov> david@elroy.Jpl.Nasa.Gov (David Robinson) writes: > if (p == 0x80u) >This will coerce p to unsigned. Yes it will, but that doesn't give you the right answer. If p is a (signed) char containing 0x80, the left side is (unsigned)(int)p which is 0xffffff80U, not 0x00000080U. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint