Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2000 23:23:24 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        cjclark@home.com
Cc:        Alfred Perlstein <bright@wintelcom.net>, Marco Molteni <molter@csl.sri.com>, freebsd-chat@FreeBSD.ORG
Subject:   Re: how to do this C preprocessor trick?
Message-ID:  <20000226232324.C99617@hades.hell.gr>
In-Reply-To: <20000226003741.C20702@cc942873-a.ewndsr1.nj.home.com>; from cjc@cc942873-a.ewndsr1.nj.home.com on Sat, Feb 26, 2000 at 12:37:41AM -0500
References:  <20000225182432.A5017@sofia.csl.sri.com> <20000226001121.A20702@cc942873-a.ewndsr1.nj.home.com> <20000225214616.U21720@fw.wintelcom.net> <20000226003741.C20702@cc942873-a.ewndsr1.nj.home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 26, 2000 at 12:37:41AM -0500, Crist J. Clark wrote:
> 
> Why a,
> 
>   do { <stuff> } while(0)
> 
> Rather than just,
> 
>   { <stuff> }
> 
> That's how I group multi-statement macros, but that does not work for
> this one.

One fairly good reason that I can clearly remember is that, with the
extra do { .. } while (0) wrapping, one gets the extra benefit of being
able to define properly scoped local variables within the macro body.

-- 
Giorgos Keramidas, < keramida @ ceid . upatras . gr >
For my public PGP key: finger keramida@diogenis.ceid.upatras.gr
PGP fingerprint, phone and address in the headers of this message.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000226232324.C99617>