Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.std.c Subject: Re: Making the preprocessor substitute a '#' Message-ID: <3404@skye.ed.ac.uk> Date: 11 Sep 90 18:09:22 GMT References: <6261@castle.ed.ac.uk> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 20 In article <6261@castle.ed.ac.uk> keith@earth.ox.ac.uk writes: >Is there any way of defining a macro in an ANSI preprocessor which >substitutes a '#' plus some other text. That is, I want to say > >#define FOO # pragma bar > >and have FOO replaced by the pragma. This can't be done in ANSI C. "The resulting completely macro-replaced preprocessing token sequence is not processed as a preprocessing directive even if it resembles one." - section 3.8.3.4 #pragma is a "preprocessing directive" even though its effects may have nothing to do with preprocessing. -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin