Macros Pitfalls
Operator Precedence Errors: SQR(a + b); is expanded to: a + b*a + band not: (a + b)*(a + b)Solution :Put parentheses (or braces) around Macro#define SQR(x) ((x) * (x))
Side Effects Errors: SQR(i++);expanded to: i++ * i++which increments i twice.
Unnecessary Function Calls: SQR(long_function(a,b,c));will evaluate the function twice.
There are no general solutions for the last two errors - so be cautious and wise !