In a previous post, Automatic Enum Stringification in C via Build-Time Code Generation , I described how to extract enum labels and values directly from DWARF debug information at build time. enum color { C_NONE , C_RED , C_YELLOW , C_GREEN } ; // Request enum descriptor for e_color ENUM_DESCRIBE ( e_color , enum color ) void foo ( enum color c ) { printf ( "Color=%s(%d) \n " , ENUM_LABEL_OF ( e_color , c ), c ) ; } Enter fullscreen mode Exit fullscreen mode In a follow-up article, I wrote about the next logical step: reverse conversion from symbolic name to value. This is useful when reading external input keyed by enum values: command-line arguments, configuration files, or user input. ENUM_DESCRIBE ( e_color , enum color ) bool parse_color ( const char * label , enum color * var ) { return ENUM_PARSE_LABEL ( e_color , label , var ) ; } Enter fullscreen mode Exit fullscreen mode Medium Article (No Paywall): Automatic Enum Handling in C — Parsing, Validating and Iterating .…