Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to wri
#define
I normally do it the giant switch case way, although I make it somewhat easier with:
#define STR(code) case code: return #code switch (errorCode) { STR(NO_ERROR); STR(ONE_KIND_OF_ERROR); }
This is a good question, I'm interested to see what better ways people have