Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site druak.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!drutx!druak!ddc From: ddc@druak.UUCP (CusterDD) Newsgroups: net.unix-wizards Subject: Unsigned and Bitwise Operators Message-ID: <638@druak.UUCP> Date: Mon, 25-Jun-84 15:59:48 EDT Article-I.D.: druak.638 Posted: Mon Jun 25 15:59:48 1984 Date-Received: Thu, 28-Jun-84 01:45:26 EDT Organization: AT&T Information Systems Laboratories, Denver Lines: 30 The following program always reports -1 is negative, -1 is positive on UNIX 5.05 running on VAX-11/780, 3B20 and 3B2. I used the cc compiler ============= #include main() { char foo; unsigned char ufoo; foo = ufoo = 1; if ((-1 | foo) < 0) printf("-1 is negative"); if ((-1 | ufoo) > 0) printf("-1 is positive"); } ============== If the ufoo test were to read: if ((-1 | ufoo) < 0) printf("-1 is positive"); then the printf would not be executed. David Custer AT&T Information Systems Labs (303) 538-3517 {druak | druky | druxp}!ddc UNIX is a trademark of AT&T Bell Laboratories