This one bit me today

Stephen M. Kennedy smk at cbnews.ATT.COM
Fri Oct 6 23:23:22 AEST 1989


In article <832 at crdos1.crd.ge.COM> davidsen at crdos1.UUCP (bill davidsen) writes:
>  This is a good example, and I thank you. I have added something
>similar to my list of things to think about in the pointers section of
>my C course notes.
>  It pops up in macros from time to time. Consider:
>	#define xavg(m) (sum+3)/m
Why did you put this in the pointers section?  This is just a poorly
parenthesized macro.  Consider "y = 1 / xavag(10);" or "xavg(n * 10)".

p.s. In another article, did someone say it was ok to define an abs macro as
     -(x)?  What about "y = -abs(x);"?
---
Steve Kennedy
att!cbosgd!smk
"I love you, Kate"



More information about the Comp.lang.c mailing list