Recursive macros

Sandeep kochhar at harvard.harvard.EDU
Thu Mar 7 04:15:30 AEST 1991


hi!
The man page for cpp on my sun 4 says that the -R flag allows
the definition of recursive macros.
I have two questions regarding this:

1. Can someone send me an example of how such a macro works, especially
how the termination condition works?

2. Can this be used to define a macro, say FOO(a, n) which works as:	
	FOO(a, 1) expands to 	a
	FOO(a, 2) expands to    a * a
	FOO(a, 3) expands to    a * a * a

	etc.

Reply by e-mail preferable, since I'm not a regular reader.
Thanks in advance for any help.

-- 

Sandeep Kochhar
Harvard University              email: kochhar at endor.harvard.edu
33 Oxford st,                   tel:   (617) 495-3988            
Cambridge, MA 02138             fax:   (617) 495-9837



More information about the Comp.lang.c mailing list