From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Meissner To: Zack Weinberg Cc: Horst von Brand , gcc@gcc.gnu.org Subject: Re: [patch] beginnings of the macro rewrite Date: Mon, 24 Apr 2000 08:57:00 -0000 Message-id: <20000424115711.16845@cse.cygnus.com> References: <200004212015.e3LKFsm06024@sleipnir.valparaiso.cl> <20000422103307.C8273@wolery.cumb.org> X-SW-Source: 2000-04/msg00480.html On Sat, Apr 22, 2000 at 10:33:07AM -0700, Zack Weinberg wrote: > - macros are not disabled during their own expansions. The practical > effect is that > > #define EPERM EPERM Yes, obviously people never did this with the traditional cpp. > will cause infinite recursion if you use EPERM anywhere. There are > some perverse cases where it might actually be useful, though. > > - macro arguments are expanded even inside strings and character > constants (but no effort is made to quote special characters). > > - the # and ## (stringize and paste) operators are not available. > > - comments are replaced by nothing _after_ arguments are substituted, > which means /**/ can be used to paste tokens. > > - there is no special protection against accidental token paste; if > you write > > #define foo(x) x+b > foo(+); > > you'll get ++b; instead of + +b; A lot of the above is needed by people who invoke cpp to handle preprocessing outside of the compiler. For example, xrdb uses the preprocessor to process ifdef's in the resources file (a feature I happen to use so I can adjust the sizes of windows based on the screen size). I believe X's xmkmf also uses the standard preprocessor to create a Makefile from an Imakefile. I know in the past perl 4.036 used it too, but I don't know if modern perl's currently use it. -- Michael Meissner, Cygnus Solutions, a Red Hat company. PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA Work: meissner@redhat.com phone: +1 978-486-9304 Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482