On Dec 29, 2003, at 15:54, Jamis Buck wrote:

>  why do some macros wrap their contents in a "do { ... } while(0)"?  
> Is this preferable to simply wrapping them in curly braces ("{...}")?  
> Is it simply a matter of matz's programming style, or is there some 
> subtler issue in effect here?
>

It's good style in general. Consider

   if (something)
     MACRO;

and

   if (something)
     MACRO;
   else
     puts("hello");

With just {}'s around the macro, the second case wouldn't compile 
(because of the semicolon).


Cheers


Dave