EDIT RE-EDITED
in literature I can remember always the form do {..} while(0)
(sometimes even with the ;, but this form proved to be wrong). Since macros are literal substitution, it is easy to imagine that there's a difference when { }
is allowed but do { } while(0)
is not, or when you need the MACRO behaves like a "statement" ({ };
do not, while do { } while(0);
does; an example is the case of if / else( if):
if (COND)
{ // MACRO(..);
...
};
else
{ // this is an else without if
}
while
if (COND)
do { // MACRO(..);
...
} while(0);
else
{
// this work properly
}
So the first has a void statement that syntactically makes impossible to "join" the else to its if, while the second form is correct (and if the macro has the final ; as I remembered to have seen somewhere, the same error of the first form occurs)