Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site root44.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!vax135!ukc!hirst1!root44!addw From: addw@root44.UUCP (Alain Williams) Newsgroups: net.lang.c,net.bugs.4bsd Subject: Parenthesis error in 4.2bsd c compiler Message-ID: <4894@root44.UUCP> Date: Tue, 4-Sep-84 13:19:24 EDT Article-I.D.: root44.4894 Posted: Tue Sep 4 13:19:24 1984 Date-Received: Sun, 26-Aug-84 01:41:22 EDT Organization: Root Computers Ltd. Lines: 26 I ran the following on a few machines: main() { unsigned u, u2; int m_7 = -7, two = 2, i, j; u = m_7; i = (u % two); j = ((int) u) % two; printf("%u %d %d %d %d\n", u, (int) (u%two), i, (u%two), j); } Machine, O/S Result Vax 4.2bsd 4294967289 -1 1 1 -1 PDP11/44 S III 65529 1 1 1 -1 68000 S 5 4294967289 1 1 1 -1 Note the second number printed in each case. Why does the Vax treat '(int) (u%two)' as '((int) u) % two' ???? Most annoying. Alain Williams, Root Computers Ltd, London. {ENGLAND}!hirst1!root44!addw edai!root44!rootis!addw ukc!root44!addw