[vox-tech] Nifty macro expansion bug

Mark K. Kim lugod3MAPS at cbreak.org
Thu Jan 18 20:12:13 PST 2007


On Thu, Jan 18, 2007 at 05:31:34PM -0800, Gabriel G. Rosa wrote:
[snip]
> > I believe the standard way of doing macros in the linux kernel is to use a
> > bogus do-while, ie:
> > 
> > #define CRASHMACHINE() do { laughtAtUser(); crashMachine(); } while(0);
[snip]
> Oh, and right after I hit send the real reason for the do-while instead
> of just {} comes to me, as does where I read it:
> 
> http://kernelnewbies.org/FAQ/DoWhile0

Good point.

although.. it appears one should not have the semicolon at the end of
"while(0)"..



More information about the vox-tech mailing list