home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!tlg
- From: tlg@uknet.ac.uk (Tim.Goodwin)
- Newsgroups: comp.lang.c
- Subject: Re: Concatenation of two macros?
- Message-ID: <1206@uknet.ac.uk>
- Date: 23 Jul 92 17:34:12 GMT
- References: <1FE7B81211DF800725@ursula.lucas.lu.se>
- Organization: UKnet
- Lines: 29
-
- In article <1FE7B81211DF800725@ursula.lucas.lu.se> KOSU_MATSB@ROUTH.KOSUFY.LU.SE writes:
- >
- > Concatenation of two macros. Is it possible?
- >
- > If i have the following two definitions:
- > #define A pre
- > #define B post
- > And want to "#define C" to be "prepost" BUT as an
- > expression of A and B! How do i do it?
- > #define C (expression of A and B to yield prepost)
-
- This is alluded to in the FAQ (question 5.2). You need the token
- pasting operator ##.
-
- #define A pre
- #define B post
- #define C A ## B
-
- This is highly unlikely to work on a pre-ANSI compiler: if you're stuck
- with such a beast you *may* be able to use
-
- #define C A/**/B
-
- instead.
-
- Tim.
- --
- The GNU is in fact the legendary and much-berated | ; who am i
- feeping creature - Malcolm Wallace. | uknet.ac.uk!tlg
-