Re: C++ Macros, ##, and ::

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

 



Daniel Lohmann wrote:

On 27.03.2008, at 21:59, Harvey Chapman wrote:
Why does ...

#define MT(name) { name::Type, name::Create }

work, and ...

#define MT(name) { name##::Type, name##::Create }

does not?

AFAIK :: is a delimiter to the preprocessor (similar to ,). Hence, the first one should be portable; the latter one does not work as the result of the concatenation has to be a token.

To clarify this in the code , you could even write:

#define MT(name) { name :: Type, name :: Create }

you are correct on all points. '::' is a token in its own right.

nathan.

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery


[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