Making the preprocessor substitute a '#'
Richard Tobin
richard at aiai.ed.ac.uk
Wed Sep 12 04:09:22 AEST 1990
In article <6261 at castle.ed.ac.uk> keith at 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 at uk.ac.ed
AI Applications Institute, ARPA: R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin
More information about the Comp.std.c
mailing list