Possible Duplicates:
Why are there sometimes meaningless do/while and if/else statements in C/C++ macros?
What's the use of do while(0) when we define a macro?
Is there a difference between
#define MACRO(x) \
{ \
... \
}
and
#define MACRO(x) \
do { \
... \
} while(0)
?
do { … } while(0) allows the macro to be used in conditional code.
Looks like this question has been asked before: C multi-line macro: do/while(0) vs scope block
Here’s another link to a couple of reasons to do so, and why to omit the semicolon at the end.