I've seen this before but I can't recall the reasoning for it.
When defining a multi-statement macro people use this construct:

#define MY_MACRO(FOO)      \
   do {                    \
        statement1(FOO);   \
        statement2(FOO);   \
        statement3(FOO);   \
   } while(0)

Why is the do/while loop used?

I'm asking here so everyone can be educated.

-Brian

----------------------------------------------------------------------
Brian Paul        Avid Technology / Softimage      [EMAIL PROTECTED]


_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to