I want to create function name inside macro depending on type defined by another macro. For example if I have defined the following macro:
#define TYPE int
my function name should look like this
int_allocate
I have tried this:
#define CREATE_NAME(VTYPE) VTYPE _allocate
#define FUNCTION_NAME CREATE_NAME(TYPE)
FUNCTION_NAME
and got the following line
int _allocate
as you can see there is one space between int and _allocate. I know how to concatenate these lines, it should be
#define CREATE_NAME(VTYPE) VTYPE ## _allocate
but in this case instead of getting int_allocate I get TYPE_allocate. When I pass int as argument I get correct result
#define FUNCTION_NAME CREATE_NAME(int)
but I need to pass macro as argument
How to solve this problem? Thanks in advance.