help-gengetopt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-gengetopt] Re: Gengetopt 2.21 enhancement suggestions


From: J. David Bryan
Subject: Re: [help-gengetopt] Re: Gengetopt 2.21 enhancement suggestions
Date: Thu, 18 Oct 2007 10:58:23 -0400

On 18 Oct 2007 at 9:10, Lorenzo Bettini wrote:

> ...since this feature was added in the previous version only, now it is
> the best time to write the _init function correctly (i.e., initialize
> fields with their default values).

I agree.  With the current all-zeros approach, if you later add a new field 
and default it to 1 within the parser (but not in "_init"), then programs 
using "_init" will not work properly, because that field will be 0 when 
passed via "_parser_ext".


> probably, since also an init function accepting a pointer to an existing
> params structure would be useful; thus there would be
> 
> void cmdline_parser_params_init(struct params *params);
> struct params *cmdline_parser_params_create();
> 
> this change of signature (and these names are more appropriate as
> well) would make previous code non compilable and would catch the
> attention of the programmer so that he can realize that something has
> changed.

That would be fine.


> I could also use the first function in all the generated parser 
> functions (by avoiding current duplication of code).
> 
> what do you think?

I think that avoiding duplication of code is good.  :-)

                                      -- Dave





reply via email to

[Prev in Thread] Current Thread [Next in Thread]