Suppose I have a macro defined as this:
#define FOO(x,y) \ do { int a,b; a = f(x); b = g(x); y = a+b; } while (0)
When expanding the macro, does GCC "guarantee" any sort of uniqueness to a,b? I mean in the sense that if I use FOO in the following manner:
int a = 1, b = 2; FOO(a,b);
After, preprocessing this will be:
int a = 1, b = 2; do { int a,b; a = f(a); b = g(b); b = a+b; } while (0)
Can/will the compiler distinguish between the a
outside the do{} and the a
inside the do? What tricks can I use to guarantee any sort of uniqueness (besides making the variables inside have a garbled name that makes it unlikely that someone else will use the same name)?
(Ideally functions would be more useful for this, but my particular circumstance doesn't permit that)