Calling multiple functions in a macro.

Paul J. Mech pmech at oucsace.cs.OHIOU.EDU
Wed Nov 2 08:18:44 AEST 1988


In article <353 at marob.MASA.COM>, daveh at marob.MASA.COM (Dave Hammond) writes:
+ In attempting to construct a macro which calls several functions,
+ but can be used as a single statement (i.e. without braces in an if/else
+ construct), I can see 2 possible alternatives:
+ 
+ 1.
+ #define FOO()	do { foo1(); foo2(); foo3() foo4(); } while(0)
+ 
+ 2.
+ #define FOO()	foo1(), foo2(), foo3(), foo4()
+ 
how about

#define FOO() { foo1(); foo2(); foo3(); foo4(); }



More information about the Comp.lang.c mailing list