On 10/17/2017 12:37 AM, Pádraig Brady wrote:
+#define check_argument(arg) \
+ if (k == n_settings - 1 || ! settings[k+1]) \
+ { \
+ error (0, 0, _("missing argument to %s"), quote (arg)); \
+ usage (EXIT_FAILURE); \
+ }
How about making this a static function instead of a macro? I am leery
of macros for all the usual reasons. Admittedly the static function will
also need k, n_settings, and settings as arguments; still, it seems
cleaner to me overall.
If you do keep it a macro, please put it inside a do...while so that it
doesn't cause problems as a then-part with a following else.