do{..}while 0 (using MACRO)

Sea Way Jan swj at omni.ECE.CMU.EDU
Fri Aug 17 03:21:02 AEST 1990


I have been following this "do{stmt1;stmt2;...}while 0" suggestion for
MACROs. I have a question that is bothering me for a while:

Why bother use 

#define MACRO(..) do{stmt1;stmt2;...}while 0

when you can just use:

#define MACRO(..) {stmt1;stmt2;...}

Any explanation will be appreciated.
Seaway Jan
Carnegie Mellon



More information about the Comp.lang.c mailing list