From: utzoo!decvax!harpo!seismo!hao!hplabs!sri-unix!chris.umcp-cs@Udel-Relay Newsgroups: net.unix-wizards Title: Re: Multiple statements in C macros: C s - (nf) Article-I.D.: sri-arpa.890 Posted: Mon Mar 28 12:16:11 1983 Received: Mon Apr 18 07:38:24 1983 From: Chris Torek , To: Charles F. Von Rospach y> hplabs!hao!cires!nbires!crp@UCB-VAX Cc: Unix-Wizards@SRI-UNIX Via: UMCP-CS; 29 Mar 83 0:10-EST There is only one problem with debug functions, as opposed to macros: they're slower. (Though if memory is more important than speed, they're usually smaller.) If the stuff can be conditionally compiled that's even better. If you have multi line debug functions, or functions with variable # of args, you can always do this: /* if DEBUG, call debugfunc for bugout. Otherwise, discard all bugouts. In either case, generate exactly one statement per bugout. */ #ifdef DEBUG # define bugout(x) debugfunc x #else not DEBUG # define bugout(x) #endif DEBUG ... stmt; bugout ( (param1,param2,param3) ); stmt; bugout ( ("got here") ); ... While it looks a bit strange, it works. (I even just tested it!) - Chris