Lots of features can be abused as well as used.
__COUNTER__ can be useful when you want an identifier within a macro
that must be different from any other identifier each time the macro is
invoked. But you should never depend on what the actual value is.
An example of where I have used it is for a "static_assert" macro for
pre-C11 or pre-C++11. Clearly this is no longer needed for modern
language standards, but it is very useful for C99 coding:
#define STATIC_ASSERT_NAME_(count) STATIC_ASSERT_NAME2_(count)
#define STATIC_ASSERT_NAME2_(count) assertion_failed_at_line_##count
#define static_assert(claim, warning) \
typedef struct { \
char STATIC_ASSERT_NAME_(__COUNTER__) [(claim) ? 1 : -1]; \
} STATIC_ASSERT_NAME_(__COUNTER__)
This lets you write, for example:
static_assert(sizeof(int) == 4, "Code assumes 4-byte int");
You can put it outside or inside functions, and no code is generated and
no code is wasted.
The alternative to __COUNTER__ is __LINE__. I used to use that, but if
you coincidentally have static_assert's at the same line number in two
headers (or a header and the C or C++ file) used in the same
compilation, you get a collision. __COUNTER__ avoids that.
Does this mean it would be nice to see __COUNTER__ standardised? Well,
there would be no point in doing it for this use-case. Maybe there are
other use-cases that benefit from it, where there are similar advantages
over __LINE__. I don't think there are many new possibilities for
errors or bad code that it would open up, compared to using the current
standard alternative of __LINE__.
(I have no idea what use Frederick has for __COUNTER__.)