help-gengetopt
[Top][All Lists]
Advanced

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

Re: [help-gengetopt] gengetopt: initialization of args_info_help[]


From: Lorenzo Bettini
Subject: Re: [help-gengetopt] gengetopt: initialization of args_info_help[]
Date: Tue, 16 Dec 2008 12:49:02 +0100
User-agent: Thunderbird 2.0.0.18 (X11/20081125)

Andre Noll wrote:
On 09:30, Lorenzo Bettini wrote:
So for N parsers, I have to allocate N args_info structures and call
N init functions even in the case I just want to print the short help.
Is this behaviour intended?

I never thought about such a situation actually; I think that that init help function might be made public and callable from outside

Yes, that would be easiest, one just has to remove the static
keyword in the .c file and add the function prototype to the .h file.

Alternativly one could change the cmdline_parser_init function so that
it just calls init_help() if called with a NULL pointer. Currently,
such a usage would lead to a segfault.


mh... probably the first alternative has a cleaner semantics

An alternative would be to initialize also the short help by using
string literals, just like the detailed help. The duplicated strings
would not increase code size because the compiler should be smart
enough to put identical strings into memory only once.
please, do not ask for that ;-) ;-)
this behavior was requested by other users and it was quite a nightmare to implement it, so I wouldn't want to go back ;-)

OK, so I won't argue for this alternative any more :) But out of
curiosity, what were the problems in inplementing it this way?

actually, I don't remember all the details now, but the problem was in the generation of code and keeping tracking of all kinds of options and performing the right assignments...

cheers
        Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net




reply via email to

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