Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: This one bit me today Message-ID: <1243@virtech.UUCP> Date: 7 Oct 89 12:19:26 GMT References: <2432@hub.UUCP> <832@crdos1.crd.ge.COM> <1067@polari.UUCP> Organization: Virtual Technologies Inc Lines: 17 In article <1067@polari.UUCP>, 6sigma@polari.UUCP (Brian Matthews) writes: > > That's why anyone who knows what they're doing will parenthesize each > argument in the expansion of the macro and use liberal whitespace, thusly: > > #define xavg(m) (sum + 3) / (m) And they will also parenthesize the entire expression: #define xavg(m) ((sum + 3) / (m)) to ensure that there are no problems with evaluation order. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+