Can you make an incrementing compiler constant?
Posted
by Keith Nicholas
on Stack Overflow
See other posts from Stack Overflow
or by Keith Nicholas
Published on 2010-03-31T22:44:33Z
Indexed on
2010/03/31
22:53 UTC
Read the original article
Hit count: 257
c
While sounding nonsensical.....
I want a Contant where every time you use it it will increment by 1
int x;
int y;
x = INCREMENTING_CONSTNAT;
y = INCREMENTING_CONSTNAT;
where x == 1; and y == 2
Note I don't want y = INCREMENTING_CONSTNAT+1 type solutions.
Basically I want to use it as a compile time unique ID ( generally it wouldn't be used in code like the example but inside another macro)
© Stack Overflow or respective owner