do {...} while (0)
Michael ODonnell
michael.odonnell at comcast.net
Sat Feb 7 09:56:16 EST 2009
> But if you change the macro to:
> #define b0rken(x) ({return x;})
> you will find that the compiler likes it again.
I mistakenly interpreted your statement that the two constructions
are equivalent:
> What I see confufsing is:
> do { ... } while(0);
[...]
> { ... } would be equivalent to above
...to mean that you believe that they are generally interchangeable.
Since that do-while(0) trick is in fairly common usage (often inside
macros) I just wanted to illustrate a situation where they're not.
More information about the gnhlug-discuss
mailing list