How to define a macro (this Q is somehow related to this Q and CashCow’s answer) which will expand to a different integer if this macro is used on different line in code?
I would like to be able to type:
X<1> _0;
X<1> _1;
after such def. I would like _0 and _1 to be of different types.
you can use something like this:
or if your only doing this for one know type:
I suggest using
__COUNTER__instead of__LINE__however, it allows the type to be globalyunique, not just unique to the line.
EDIT: reread the question, what exactly do you mean by “different integer”? as in a different type or different initialization value?
or (This seems to be the one you want)