I cannot guarantee this is 100% portable, but it should work:
#define VER ((u_long)1) #define STRIP1(x) STRIP2 x #define STRIP2(x) STRIP3 x #define STRIP3(x) #define paste(x, y, z) x ## y ## z #define paste2(x, y, z) paste(x, y, z) #define fcall(fname) paste2(fname, _, STRIP1(VER))
Living example
It works by interpreting parentheses inside a VER definition as a macro definition. Here are some expansions, as they arise:
STRIP1(VER) // STRIP1 with argument VER STRIP2 ((u_long)1) // STRIP2 with argument (u_long)1 STRIP3 (u_long)1 // STRIP3 with argument u_long, followed by 1 1
If we reinstall the spaces (in any case, this is negligible), we get the following:
STRIP1(VER) STRIP2((u_long) 1) STRIP3(u_long) 1 1
Angew source share