1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include "codes.h" #define C(code) \ case (code): \ return CODE_##code##_STR; const char * code_to_str(int code) { switch (code) { C(200) C(201) C(400) C(401) C(403) C(404) C(409) C(413) C(503) } return "666 UNKNOWN CODE\r\n"; }