From: Nikolai Weibull Date: 2003-12-30T08:44:42+09:00 Subject: Re: Question about Ruby implementation * Jamis Buck [Dec, 30 2003 00:29]: > >It's good style in general. Consider > Yah, I understand that, I think. But why have MACRO wrap its contents > in a "do{...}while(0)", instead of just "{...}"? In other words, is > there a compelling reason to do this: > > #define MACRO(x) \ > do { \ > x \ > } while(0) > > instead of this: > > #define MACRO(x) \ > { \ > x \ > } > no one prefers this - some compilers actually generate code for the do-while (which is incredible...), the reason is that braces used in the second way isn't standard in C89 (if i'm not mistaken) or at least not supported by all compilers. A way would be to use another macro that would encapsulate this stuff, as GLib does provide. nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}