🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1676

Re: Making the preprocessor substitute a '#'

#1676
From: Richard Tobin
Date: Tue, 11 Sep 1990 18:09
20 lines
1271 bytes
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
Technical Details
Message-ID: <3404@skye.ed.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!ukc!edcastle!aiai!richard
References: <6261@castle.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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