RE: Token-Pasting Operator (##)

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

 



Hi Vishnu,

To use token pasting preprocessor operator, you must be pasting a token and a token to form a single new token.  You cannot be pasting two token together.

#define DO_SET_1(X, Y)      PORT ## X ##.OUTSET = PIN ## Y ## _bm
DO_SET_1(D, 0);

I am going to list out the expansion with one token per line:

PORTD
.
OUTSET
=
PIN0_bm

Notice in your macro you have this token pasting:

X ## .

You cannot token paste X substitution argument conjoined to . (dot).  That does not form a token, it forms two tokens.

If you change your #define macro to:

#define DO_SET_1(X, Y)      PORT ## X .OUTSET = PIN ## Y ## _bm

Then you will no longer be trying to form an invalid token paste between X and . (dot).

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux