Is there a way to prevent macro prescanning?
I have the following problem:
#define APE 4
#define GET_ANIMAL_NAME (a, b) ANIMAL_##b##_## a
#define CREATE_ANIMAL_E NTRY(a, b) GET_ANIMAL_NAME (a, b) = (a + b)
enum animals
{
CREATE_ANIMAL_E NTRY(2, APE)
};
this expands to
ANIMAL_4_2 = (2 + 4)
but I'd like to prevent the prescanning (at least in GET_ANIMAL_NAME )
to expand this to:
ANIMAL_APE_2 = (2 + 4)
I know it works when I move the content of GET_ANIMAL_NAME to
CREATE_ANIMAL_E NTRY - but I need the name macro in other files, too.
I have the following problem:
#define APE 4
#define GET_ANIMAL_NAME (a, b) ANIMAL_##b##_## a
#define CREATE_ANIMAL_E NTRY(a, b) GET_ANIMAL_NAME (a, b) = (a + b)
enum animals
{
CREATE_ANIMAL_E NTRY(2, APE)
};
this expands to
ANIMAL_4_2 = (2 + 4)
but I'd like to prevent the prescanning (at least in GET_ANIMAL_NAME )
to expand this to:
ANIMAL_APE_2 = (2 + 4)
I know it works when I move the content of GET_ANIMAL_NAME to
CREATE_ANIMAL_E NTRY - but I need the name macro in other files, too.
Comment