Christian Stimming <christ...@cstimming.de> writes: > But in general: I don't see the value of those macros here anyway. I > mean, the list of enum values need to appear in the definition of > LOG_LEVEL_LIST anyway. Passing this list through two other macros > doesn't really save any typing except for the two words "typedef enum > { ... }". The macros might have made a little bit of sense if it were > for a unified generation of some wrapper function (e.g. the conversion > functions from and to string)... oh, I see: Some of the enum > declaration actually use those: AS_STRING_DEC, AS_STRING_FUNC, > FROM_STRING_DEC, FROM_STRING_FUNC.
Yes, there is value to make sure that you only have to make changes in one place. > It's a classical tradeoff between saving of typing and making the code > less readable: IMHO it is a big disadvantage that those functions are > hidden behind this non-understandable macros. Because of that, I would > rather prefer writing all the declaration and also those conversion > functions in plain text instead of hiding them behind macros. This "macro maze" was done to make it easier to maintain the list of macros. Before, if you added a macro you had to make changes in about three or four places! Now you only need to make changes in one place and it all just works. The idea here is that you can define the enumerator and it automatically creates the enum->string and string->enum functions for you. > But in any case, those enums which don't use the conversion functions also > don't need to use the DEFINE_ENUM macro. Hence, feel free to submit a patch > that replaces DEFINE_ENUM by a normal declaration for all enums which don't > use the conversion function macros. Thanks! Sure, if you *never* use the conversion functions then yes, I feel you can use a regular enum instead of the DEFINE_ENUM macro. > Christian -derek -- Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory Member, MIT Student Information Processing Board (SIPB) URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH warl...@mit.edu PGP key available _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel