I cannot imagine it making any difference when used sensibly in this particular case, but consider this:
#define add(x,y) x+y
int i=add(3,5)*2
Now you would expect i to have the value 16, right?, but it would expand to i=3+5*2, giving i the value 13.
HolyBlackCat wrote in a comment that float x = sin BUF;
would not compile in the latter case, and this is completely true. However, using macros like that is a VERY bad idea.
Putting parenthesis around never hurts and often helps. Macros are basically just an advanced copy paste. So if you can imagine a piece of code where the character sequence (8)
would yield another result than 8
, then those two macros will differ in the same way.
For similar reasons, if a macro contains several statements, it is a good idea to enclose them in a do-while loop. Consider this:
#define callMy2Funcs(x,y) \
myFunc1(x); \
myFunc2(y);
Now this:
if(x>5)
callMy2Funcs(x,x);
will expand to
if(x<5)
myFunc1(x);
myFunc2(x);
instead of
if(x<5) {
myFunc1(x);
myFunc2(x);
}
The solution is this:
#define callMy2Funcs(x,y) \
do {\
myFunc1(x); \
myFunc2(y); \
} while(0)