Bug#195149: pasting "foo" and "bar" does not give a valid preprocessing token
- To: 194709@bugs.debian.org, 194823@bugs.debian.org, 194888@bugs.debian.org, 194890@bugs.debian.org, 194944@bugs.debian.org, 195036@bugs.debian.org, 195145@bugs.debian.org, 195149@bugs.debian.org, 195155@bugs.debian.org, 195157@bugs.debian.org, 195170@bugs.debian.org
- Subject: Bug#195149: pasting "foo" and "bar" does not give a valid preprocessing token
- From: "Juergen E. Fischer" <fischer@linux-buechse.de>
- Date: Thu, 29 May 2003 12:07:32 +0200
- Message-id: <[🔎] 20030529100732.GA25748@linux-buechse.de>
- Reply-to: "Juergen E. Fischer" <fischer@linux-buechse.de>, 195149@bugs.debian.org
Hi there,
the problem in all above bugs is the wrong use of the ## preprocessor
operator. The general solution seems to be to just get rid of the
offending ##.
It's used to concatenate tokens to form one (AFAIKS only useful for
identifiers). The error occurs when one tries to concatenate things
that cannot be one token. gcc-3.3 doesn't like that anymore.
So
#define m(a) foo->##a
should read
#define m(a) foo->a
(same goes for other tokens; "::", "(", "," etc).
An other case are strings. Consecutive string tokens
will be concatenated by the compiler so the use of
## would be also needless here:
So
#define m(a) "foo:" ## a
should read
#define m(a) "foo:" a
Jürgen
--
Unix regular expression: (.*[^-a-zA-Z0-9_.])?)
Windows regular expression: "Damn.... it crashed again"
Reply to: