Hi Lorenzo,

> the
> 
> char * const *argv
> 
> libc declaration of getopt_long (which looks wrong, since argv might
> be changed during the parsing, right?)

Yes, it is wrong because argv might be permuted by getopt_long. And
that's why gnulib's implementation uses __getopt_argv_const in the
declaration (see the comment in lib/getopt.in.h:73).

> now, I'd like to avoid the warning in the generated parser when using
> gnulib, but I'd like to avoid it also when using libc getopt_long
> version...
> 
> what would you suggest?

I believe typecasting to `char *__getopt_argv_const *___argv' would be
the best way to handle this. Keep in mind, though, that
__getopt_argv_const is a macro, which is defined only if you include
gnulib's version of getopt.h. Perhaps some additional #ifdef magic
would be required before the cast, e.g.:

#ifndef __getopt_argv_const
# define __getopt_argv_const const
#endif

Regards,
Sergey


Reply via email to