3 ms·
That's true, and in the event that you're actually using __COUNTER__ for something you could build something similar out of #include with a header that incremen
by mrgriffin 9y ago
That's true, and in the event that you're actually using __COUNTER__ for something you could build something similar out of #include with a header that increments an internal number.
// COUNTER.h
#if !defined(COUNTER)
#define COUNTER 0
#elif COUNTER == 0
#undef COUNTER
#define COUNTER 1
#elif COUNTER == 1
#undef COUNTER
#define COUNTER 2
...
#end if
And then change each invocation of ELEMENT to have a leading #include "COUNTER".
#include "COUNTER.h"
ELEMENT(x)
#include "COUNTER.h"
ELEMENT(y)
Note that if you take this approach then (as far as I know) you're actually writing standard C!