Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!ico!ism780c!news From: news@ism780c.isc.com (News system) Newsgroups: comp.lang.c Subject: Re: () ignored in some expressions Message-ID: <41297@ism780c.isc.com> Date: 13 Apr 90 00:48:58 GMT References: <48079@lanl.gov> <1272@sdrc.UUCP> Reply-To: marv@ism780.UUCP (Marvin Rubenstein) Organization: Interactive Systems Corp., Santa Monica CA Lines: 21 In article <1272@sdrc.UUCP> scjones@sdrc.UUCP (Larry Jones) writes: >In article <48079@lanl.gov>, u096000@lanl.gov (Roger A. Cole) writes: >> In K&R1, expressions involving one of the associative and commutative >> operators can be arranged even when parenthesized. > >Well, if the operators ARE commutative and associative, it >doesn't make any difference! In the environment the C grew up >in, integer arithmetic overflows wrap around without producing >any exceptions, so the integer operators really are associative >and commutative. A common misconception. Integer operators are associaive for add and subtract but not for multiply and divide. for example: long x=70000; x*(x/x); /* 700000 if parens are honored */ (x*x)/x; /* 8643 if parens are honered */ The above assumes longs are 32 bits. Marv Rubinstein