Multiple-statement macros

utzoo!decvax!genradbo!wjh12!clp utzoo!decvax!genradbo!wjh12!clp
Wed Jan 26 16:16:02 AEST 1983


I just wanted to comment that in writing an interpreter, I have been
 writing C functions which I plan to later convert into macros for speed
 (in-line code). This ends up with some macros like:

#define	newMtdCx(clPtr)	{
			    OBJPTR  newContext = makeContext();

			    ...code which uses newContext many times...
			}
(where I've left out the '\'s necessary at the end of each line but the last)

In cases where declarations are needed (e.g., and exchange routine), commas
 are not good enough for multiple statements... I've had to put surrounding
 braces in all the if portions of if...else pairs to be safe.
							     Charles L. Perkins
						    ...decvax!genradb!wjh12!clp



More information about the Comp.lang.c mailing list