In a macro I want to generate a variable with a different name and try to use __LINE__
as a way to differentiate them. A simplified sample:
#define UNIQUE_INT int prefix##__LINE__
UNIQUE_INT;
UNIQUE_INT;
But it seems that __LINE__
is not expanding as I get "int prefix__LINE__' : redefinition" in the second one.
I suppose that __LINE__
can not be used in a macro definition as if it expanded would do to the line number of the #definition rather than the line of the invocation of the macro, but let me ask just in case someone has something to say.