[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195149: pasting "foo" and "bar" does not give a valid preprocessing token



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: