A direct application of the gating operator may be useful.
#define stringize(x) #x
printf("%s\n", stringize(ERROR_NONE));
, . :), X
enumstring.c
#include <stdio.h>
#define NAMES C(RED)C(GREEN)C(BLUE)
#define C(x) x,
enum color { NAMES TOP };
#undef C
#define C(x) #x,
const char * const color_name[] = { NAMES };
int main( void )
{ printf( "The color is %s.\n", color_name[ RED ]);
printf( "There are %d colors.\n", TOP ); }
stdout
The color is RED.
There are 3 colors.
. , , , switch-case - , , enums.