Xref: utzoo comp.lang.c:15792 comp.lang.c++:2481 Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!ames!pacbell!att!chinet!mcdchg!clyde!wayback!atux01!gal From: gal@atux01.UUCP (G. Levine) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: Would *you* get caught by this one? Summary: parentheses!!! Keywords: Assignops Message-ID: <946@atux01.UUCP> Date: 24 Jan 89 15:43:11 GMT References: <139@mole-end.UUCP> <1989Jan13.085902.2057@LTH.Se> Organization: AT&T CSEd/CET, Piscataway, N.J. Lines: 25 In article <1989Jan13.085902.2057@LTH.Se>, newsuser@LTH.Se (LTH network news server) writes: > In article <139@mole-end.UUCP> mat@mole-end.UUCP (Mark A Terribile) writes: > > When is a *= b not the same as a = a * b ? > > For example, if you have: > > #define b x + y > > then: > > a *= b <=> a *= (x + y) > a = a * b <=> a = (a * x) + y This is why its so important to use parentheses in a #define statement. Changing the define statement to #define b (x + y) will save a lot ot headaches! gary -------------------------------------------------------------------------------- If it wasn't so cool out today, it would be warmer. --------------------------------------------------------------------------------