Paul Eggert wrote: > First, human_options should probably not output to stderr or exit, but > should instead let the caller do it.
Indeed; this allows to not increase the number of arguments to human_options from 3 to 4. > +static char opt_str_storage[3] = {'-', 0, 0}; > +#define OPT_STR(opt_idx, c, long_options) \ > + ((opt_idx) < 0 \ > + ? (opt_str_storage[1] = c, opt_str_storage) \ > + : LONG_OPT_STR (opt_idx, long_options)) I would not put a statically allocated array into every compilation unit that includes "system.h". In fact, the middle part of OPT_STR does not need to be a macro or inline function; it can as well be a plain function: #define OPT_STR(opt_idx, c, long_options) \ ((opt_idx) < 0 \ ? short_opt_str (c) \ : LONG_OPT_STR (opt_idx, long_options)) /* Define in a .c file. */ const char * short_opt_str (char c) { static char opt_str_storage[3] = { '-', 0, 0 }; opt_str_storage[1] = c; return opt_str_storage) } Bruno