home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!emory!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!sics.se!eua.ericsson.se!ericom!terminus.ericsson.se!!rejkjavik!srl
- From: srl@terminus.ericsson.se (Steve Langstaff)
- Newsgroups: comp.lang.c
- Subject: Re: Preprocessor question
- Message-ID: <1099@quirm.terminus.ericsson.se>
- Date: 27 Jan 93 09:48:00 GMT
- References: <1k44lqINNjr3@rs2.hrz.th-darmstadt.de>
- Sender: usenet@terminus.ericsson.se
- Reply-To: srl@terminus.ericsson.se
- Distribution: world
- Organization: Camtec Electronics (Ericsson), Leicester, England
- Lines: 24
- Nntp-Posting-Host: rejkjavik
-
- In article 1k44lqINNjr3@rs2.hrz.th-darmstadt.de, misar@rbg.informatik.th-darmstadt.de (Walter Misar) writes:
- : In article <mick.728072797@picus>, mick@dcs.bbk.ac.uk (Mick Farmer) writes:
- : > Hi,
- : >
- : > Karim asks how to get a preprocessor macro recognised inside
- : > a string. The answer, at least in ANSI C, is to use the
- : > stringising operator and string concatenation:
- : >
- : > #define JUNK 50
- : > static char *junk = #JUNK " ways to leave your lover"
- : ^^^^^
- : Nope, #token works only with #defines like in:
- : #define stringify(x) #x
- : #define str_exp(x) stringify(x) /* this extra level IS necessary */
- : static char *junk = str_exp(JUNK) "ways ....";
- :
- [snip]
-
- Why is the extra level necessary?
-
- ---
-
- | Steve Langstaff - Ericsson CAMTEC |
-
-