On Thu, 8 Jul 1999, Brian Paul wrote:
**I've seen this before but I can't recall the reasoning for it.
**When defining a multi-statement macro people use this construct:
**
**#define MY_MACRO(FOO) \
** do { \
** statement1(FOO); \
** statement2(FOO); \
** statement3(FOO); \
** } while(0)
**
**Why is the do/while loop used?
I never used this construct, but it seems to be a good thing for
MY_MACRO(y);
if(x < y)
MY_MACRO(x);
else
...
that means, if you _always_ want to put ';' behind macro. With
#define MY_MACRO(FOO) \
{ \
statement1(FOO); \
statement2(FOO); \
statement3(FOO); \
}
this wouldn't work.
cu,
**
**----------------------------------------------------------------------
**Brian Paul Avid Technology / Softimage [EMAIL PROTECTED]
**
**
**_______________________________________________
**Mesa-dev maillist - [EMAIL PROTECTED]
**http://lists.mesa3d.org/mailman/listinfo/mesa-dev
**
s.i.m.o.n.
___________v_/_________________________________________________________________
simon pogarcic [EMAIL PROTECTED] www.suse.de/~sim
_______________________________________________________________________________
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev