Serious error-causing change in new CPP's -traditional behavior
Richard Earnshaw
rearnsha@arm.com
Fri May 12 10:44:00 GMT 2000
> In that case, I agree with Zack. You need to code something like:
>
> #define HASH # /* '#' isn't special on object-like macros */
> #define LPREFIX() HASH
> #define wibble (foo) mov r0, LPREFIX()foo
> wibble (4)
>
> This will also have the benefit of allowing you to change the literal prefix
> easily for different assemblers.
We were trying to avoid that particular contortion, but there are several
other reasonable solutions.
#define IMMED(x) # ## x
#define wibble(foo) mov r0, IMMED(foo)
or
#define wibble(foo) mov r0, # ## foo
or
#define wibble(foo) mov r0, #(foo) /* If brackets ok */
or
#define wibble(foo) mov r0, # /**/ foo /* I think... not tested */
or
#define IMMED(x) x
#define wibble(foo) mov r0, #IMMED(foo)
etc.
More information about the Gcc-bugs
mailing list