warning: pasting would not give a valid preprocessing token
Andrew Pinski
pinskia@physics.uc.edu
Tue Aug 21 06:37:00 GMT 2001
Change macro_test to
#define macro_test(x) temp.x++
You do not need ## in this case at all, learn some C preprocessing.
The only case you need ## is when a##x and you want a or x to be
expanded.
Thanks,
Andrew Pinski
On Tuesday, August 21, 2001, at 09:22 AM, Alex Feldman wrote:
> Hello,
>
> I compiling the follow program on Red-Hat Linux 7.0 with gcc 2.96.
>
> #define macro_test(x) tmp.##x++
> typedef struct {
> int test;
> } test_t;
> int main()
> {
> test_t tmp;
> tmp.test = 0;
> macro_test(test);
> }
>
> when I compiled this program with gcc I received the following warning:
>
> test.c:11:18: warning: pasting would not give a valid
> preprocessing token
>
> What's wrong with this macro and what this warning means?
>
> Thank you.
>
> Alex
>
>
More information about the Gcc-bugs
mailing list