Macro concatenation, function name generation

c, c-preprocessor, concatenation, macros

Solution

Because `From__` is not a token in `Map` and hence, preprocessor does not look it up.. fix is :

#define Map(From, To, val) \
        Map__##From##__##To(val)

Problem

``` #define Map(From, To, val) \ Map__##From__##To(val) Map(TYPEA, TYPEB, 22); ``` In the above code I am wondering why `Map(TYPEA, TYPEB, 22);` is getting expanded to `Map__From__TYPEB(22);` and not `Map__TYPEA__TYPEB(22);` I used gcc -E for expansion.

Original source