Re: gengetopt: initialization of args_info_help[]

Lorenzo Bettini <[email protected]> Thu, 04 Dec 2008 09:30:52 +0100
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
Andre Noll wrote:
> Hi Lorenzo,
> 

Hi Andre

<SNIP>
> 
> Before that function gets called, the contents of xxx_args_info_help
> will be undefined. Since init_help_array() is a static function, it
> is not possible to call it directly from the application that uses
> gengetopt.  The only way to get an initialized xxx_args_info_help
> array is to call xxx_cmdline_parser_init() which implicitly calls
> init_help_array().
> 
> 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

> 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 ;-)

I'll try to handle this matter soon.

thanks for the feedback
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