Suppose I have a macro defined as follows:
#define FOO (x, y) \
do {
int a, b;
a = f (x);
b = g (x);
y = a + b;
} while (0)
When expanding a macro, does GCC “guarantee” any uniqueness for a, b? I mean, if I use FOO as follows:
int a = 1, b = 2;
FOO (a, b);
After that, the pre-processing will be as follows:
int a = 1, b = 2;
do {
int a, b;
a = f (a);
b = g (b);
b = a + b;
} while (0)
Can the / compiler distinguish between a
do {} and a
do? What tricks can I use to guarantee any uniqueness (besides the fact that the variables inside have a distorted name, which is unlikely that someone else will use the same name)?
( , )