displaying #define values in C

后端 未结 4 587
孤独总比滥情好
孤独总比滥情好 2021-01-29 04:32

I have a series of #defines from a library file header of this sort:

typedef int Lib_error;   

#define   LIB_ERROR_A      ((Lib_error) 0x0000) 
#define   LIB_ER         


        
4条回答
  •  盖世英雄少女心
    2021-01-29 05:02

    Just generate a table by parsing those defines in some scripting language. Should be easy-ish to translate those defines to the declaration of a constant array of code, string structs which you can then iterate.
    Assuming the library doesn't change often, you'll only need to do this once so you don't need to bother much with script corectness etc.

提交回复
热议问题