[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: argmatch: accept perfect matches in documented arglists
From: |
Akim Demaille |
Subject: |
Re: argmatch: accept perfect matches in documented arglists |
Date: |
Sun, 19 May 2019 12:10:25 +0200 |
Hi Bruno,
I'm back to this issue now.
> Le 5 mai 2019 à 16:28, Bruno Haible <address@hidden> a écrit :
>
>> +static const char *const backup_docs[] =
>> +{
>> + N_("never make backups (even if --backup is given)"),
>> + N_("make numbered backups"),
>> + N_("numbered if numbered backups exist, simple otherwise"),
>> + N_("always make simple backups"),
>> + NULL
>> +};
>> +
>> +static const enum backup_type backup_doc_vals[] =
>> +{
>> + no_backups,
>> + simple_backups,
>> + numbered_existing_backups,
>> + numbered_backups
>> +};
>
> This is hard to maintain. Better put things next to each other that
> belong together. Namely, can you put the enum value and each docstring
> into a single struct?
>
> { no_backups, N_("never make backups (even if --backup is given)") },
> { simple_backups, N_("make numbered backups") },
> { numbered_existing_backups, N_("numbered if numbered backups exist,
> simple otherwise") },
> { numbered_backups, N_("always make simple backups") },
Yes, of course, it would be nicer, but argmatch does not force the size of the
values. And I didn't want to force the user to provide an lvalue for each
single value. So I'm using the same approach as the rest of argmatch: pass a
pointer to an array, and the size of the data.
We can provide another type restricted to ints for this common case though.
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/02
- Re: argmatch: accept perfect matches in documented arglists, Bruno Haible, 2019/05/05
- Re: argmatch: accept perfect matches in documented arglists,
Akim Demaille <=
- Re: argmatch: accept perfect matches in documented arglists, Bruno Haible, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Bruno Haible, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Bruno Haible, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Paul Eggert, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/19
- Re: argmatch: accept perfect matches in documented arglists, Akim Demaille, 2019/05/21
- Re: argmatch: accept perfect matches in documented arglists, Paul Eggert, 2019/05/21