This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add named initializers to argp/argp-parse.c


Art Haas wrote:

> @@ -97,12 +97,32 @@
>  
>  static const struct argp_option argp_default_options[] =
>  {
> -  {"help",	  '?',    	0, 0,  N_("Give this help list"), -1},
> -  {"usage",	  OPT_USAGE,	0, 0,  N_("Give a short usage message")},
> -  {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
> -  {"HANG",	  OPT_HANG,    "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
> -     N_("Hang for SECS seconds (default 3600)")},
> -  {0, 0}
> +  {
> +    .name = "help",
> +    .key = '?',
> +    .doc = N_("Give this help list"),
> +    .group = -1
> +  },
> +  {

I consider this *much* worse then what we have now.

The arrays for arg and getopt have a well-defined order of the elements.
 Nobody can change it.  Listing the options in this tabular form is not
adding any maintenance burden.  And it is much more readable.  Just
compare the effort to search for an existing entry, e.g., when adding a
new one.

-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]