Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!ucbvax!hsdndev!husc6!agate!kochhar From: kochhar@harvard.harvard.EDU (Sandeep) Newsgroups: comp.lang.c Subject: Recursive macros Message-ID: <5896@husc6.harvard.edu> Date: 6 Mar 91 18:15:30 GMT Sender: news@husc6.harvard.edu Reply-To: kochhar@harvard.harvard.EDU (Sandeep) Distribution: usa Organization: Aiken Computation Laboratory Lines: 24 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@endor.harvard.edu 33 Oxford st, tel: (617) 495-3988 Cambridge, MA 02138 fax: (617) 495-9837